docker / cli

The Docker CLI
Apache License 2.0
4.94k stars 1.93k forks source link

Issue passing environment variables with '=' character on its value (Azure ACI) #2702

Closed glauber-md closed 1 year ago

glauber-md commented 4 years ago

Description

Steps to reproduce the issue:

  1. Create an ACI context: docker context create aci MyContext --subscription-id "..."
  2. Switch to the newly created context (aci): docker context use MyContext
  3. Try to deploy the image stored on Docker Hub to ACI passing some environment variables:
    docker run \                                                                                             
    --restart on-failure \
    --name "MyApp" \
    --memory 1G \
    --cpus 1 \
    --env SPRING_DATASOURCE_DRIVER="com.mysql.cj.jdbc.Driver" \
    --env SPRING_DATASOURCE_PASSWORD="***" \
    --env SPRING_DATASOURCE_URL="jdbc:mysql://mydb.mysql.database.azure.com/db1?useSSL=true&requireSSL=false&serverTimezone=America/Recife" \
    --env SPRING_DATASOURCE_USERNAME="myusr@mydb" \
    --env ASB_CONN_STRING="Endpoint=sb://myesb.servicebus.windows.net/;SharedAccessKeyName=***;SharedAccessKey=*** \
    --env CRON_EXPRESSION="0 0/5 * * * *" \
    --env MAX_POOL_SIZE="5" \
    mydocker/myapp:1.0.0

Describe the results you received: The ACI is deployed and don't start due to some wrong parsing of env variables passed to ACI. All string values wich contains the '=' character is removed when they're passed to ACI (I assume). The point is that the values I pass on the 'env' parameter is not passed correctly to ACI; e.g.: the env param value jdbc:mysql://mydb.mysql.database.azure.com/db1?useSSL=true&requireSSL=false&serverTimezone=America/Recife when I look at it on Azure ACI variables list is jdbc:mysql://mydb.mysql.database.azure.com/db1?useSSL.

Screen Shot 2020-08-28 at 22 16 31

Describe the results you expected: Set the exact value I set for the env variable value on ACI.

Additional information you deem important (e.g. issue happens only occasionally): Happens everytime following the steps above.

Output of docker version:

Client: Docker Engine - Community

 Azure integration  0.1.12
 Version:           19.03.13-beta2
 API version:       1.40
 Go version:        go1.13.14
 Git commit:        ff3fbc9d55
 Built:             Mon Aug  3 14:58:48 2020
 OS/Arch:           darwin/amd64
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          19.03.13-beta2
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.14
  Git commit:       ff3fbc9d55
  Built:            Mon Aug  3 15:06:50 2020
  OS/Arch:          linux/amd64
  Experimental:     true
 containerd:
  Version:          v1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Output of docker info:

Client:
 Debug Mode: false
 Plugins:
  app: Docker Application (Docker Inc., v0.8.0)
  buildx: Build with BuildKit (Docker Inc., v0.3.1-tp-docker)
  ecs: Docker ECS (Docker Inc., v1.0.0-beta.5)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 1
 Server Version: 19.03.13-beta2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 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: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.19.76-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 1.945GiB
 Name: docker-desktop
 ID: XDFN:QWGF:5SUX:ZDOF:FLVK:KRYT:24WL:2XX2:QQD4:5ONK:TIEI:LF4Q
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 40
  Goroutines: 47
  System Time: 2020-09-01T00:46:00.5941928Z
  EventsListeners: 4
 HTTP Proxy: gateway.docker.internal:3128
 HTTPS Proxy: gateway.docker.internal:3129
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: true
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

Additional environment details (AWS, VirtualBox, physical, etc.):

Using the ACI (Azure Container Instance) integration.

thaJeztah commented 4 years ago

ping @ndeloof PTAL

gtardif commented 4 years ago

Thx for the report, I'll TAL. Seems the cli does not encode values before sending them to ACI

thaJeztah commented 1 year ago

Looks like this was an issue in the compose-cli wrapper, and fixed through https://github.com/docker/compose-cli/pull/598