Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Can't use Chinese in environment variables #11074

Closed
UchihaYuki opened this issue Oct 10, 2023 · 7 comments
Closed

[BUG] Can't use Chinese in environment variables #11074

UchihaYuki opened this issue Oct 10, 2023 · 7 comments

Comments

@UchihaYuki
Copy link

Description

I can't use Chinese charaters in environment variables like the following:

    environment: 
      - BRAND=哈哈哈

I got the following error:

UnicodeEncodeError: 'charmap' codec can't encode characters in position 2353-2355: character maps to <undefined>

Steps To Reproduce

You can paste the above environment variables to any service. It just can't use Chinese characters.

Compose Version

docker compose version:

Docker Compose version v2.15.1

docker-compose version

docker-compose version 1.29.2, build 5becea4c
docker-py version: 5.0.0
CPython version: 3.9.0
OpenSSL version: OpenSSL 1.1.1g  21 Apr 2020


### Docker Environment

```Text
docker-compose version 1.29.2, build 5becea4c
docker-py version: 5.0.0
CPython version: 3.9.0
OpenSSL version: OpenSSL 1.1.1g  21 Apr 2020

C:\Data\projects\zhang-san-sui\app\projects>docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.10.0)
  compose: Docker Compose (Docker Inc., v2.15.1)
  dev: Docker Dev Environments (Docker Inc., v0.0.5)
  extension: Manages Docker extensions (Docker Inc., v0.2.17)
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  scan: Docker Scan (Docker Inc., v0.23.0)

Server:
 Containers: 4
  Running: 0
  Paused: 0
  Stopped: 4
 Images: 71
 Server Version: 20.10.22
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 9ba4b250366a5ddde94bb7c9d1def331423aa323
 runc version: v1.1.4-0-g5fd4c4d
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.4.72-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 37.56GiB
 Name: docker-desktop
 ID: Z3PU:77JX:JRSE:PIYL:JOOQ:PPAZ:WMJ5:YGIK:MYC2:HZT2:EM22:KV53
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5000
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support

Anything else?

No response

@ndeloof
Copy link
Contributor

ndeloof commented Oct 10, 2023

You still have docker compose v1 installed, Docker Compose v2 doesn't have such an issue. You can confirm by using docker compose command (space) vs docker-compose

@UchihaYuki
Copy link
Author

UchihaYuki commented Oct 10, 2023

You still have docker compose v1 installed, Docker Compose v2 doesn't have such an issue. You can confirm by using docker compose command (space) vs docker-compose

I will encounter some other errors when I excute docker compose -f ${base}/docker-compose.raw.yml config > ${base}/docker-compose.yml. One of them is

extends: Support for `extends` is not implemented yet.

@UchihaYuki
Copy link
Author

UchihaYuki commented Oct 10, 2023

I'm pretty confused while reading this doc:
https://docs.docker.com/compose/compose-file/#extends
Does Compose V1 mean version 2.x and 3.x? Then what does 1.27.0 refers to?

Legacy versions 2.x and 3.x of the Compose file format were merged into the Compose Specification. It is implemented in versions 1.27.0 and above (also known as Compose V2) of the Docker Compose CLI.

Does Compose V1 refers to docker-compose and Compose V2 refers to docker compose? Shoudn't the version number of docker compose begin at v2.x? How can 1.x implement V2? So confused...

@ndeloof
Copy link
Contributor

ndeloof commented Oct 10, 2023

extends is fully supported by compose v2. v2.15.1 you are using is obsolete, please upgrade

docker compose v1 (v1.x.y) refers to the legacy python implementation, it reached end of life, don't use it

Shoudn't the version number of docker compose begin at v2.x

it does, current release is v2.22.0

Compose file format 2.x and 3.x is obsolete, compose specification supersede this versioning logic and you should stop setting a version: x attribute in your compose files.

@ndeloof ndeloof closed this as not planned Won't fix, can't repro, duplicate, stale Oct 10, 2023
@UchihaYuki
Copy link
Author

UchihaYuki commented Oct 11, 2023

I updated to Docker Compose version v2.22.0-desktop.2 now and encountered a new error.

When I run docker compose config it not just expands the extends keyword, but also adds a name attribute at the root level which is not supported by docker stack.

@ndeloof
Copy link
Contributor

ndeloof commented Oct 11, 2023

docker stack doesn't use the compose specification, you should not use docker compose to pre-process compose files for this command. See docker/cli#2527

@UchihaYuki
Copy link
Author

But you can't use extends keyword in compose file for docker stack. Is there a better way to organize my compose files for docker stack? I have several files which share the same basic compose file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants