Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Docker compose does not select specific service --profile #1636

Closed
everton-nasc opened this issue May 4, 2021 · 0 comments · Fixed by #1641
Closed

Docker compose does not select specific service --profile #1636

everton-nasc opened this issue May 4, 2021 · 0 comments · Fixed by #1641
Assignees
Labels
bug 🐞 App is not working correctly.

Comments

@everton-nasc
Copy link

Description
Seems the --profile feature is not working properly if you need to select certain services from docker-compose.yaml
The current scenario, I'm trying to select a few services and start (dev and rabbitmq services), but the command are starting all services from the docker compose file.

Using the old command docker-compose CLI, I cannot replicate the issue. I'm assuming the error is related to the new command docker compose.

Profile Table

Service (container) Docker Profile
php-fpm dev, build
redis dev
mysql dev
nginx dev
custom-app-1 custom1, build
custom-app-2 custom2
custom-app-3 custom3
rabbitmq rabbit, build

Steps to reproduce the issue:

  1. Run docker compose --profile build build (custom services)
  2. Run docker compose --profile dev --profile rabbit up

docker-compose.yaml (removed some sensitive data)

version: '3.8'
services:
  nginx:
    image: library/nginx:1.19.6-alpine
    profiles: ["dev"]
    container_name: nginx
  (...)

  php-fpm:
    image: php-fpm:latest
    profiles: ["dev", "build"]
   (...)

  custom-app-1:
    profiles: ["custom1", "build"]
    image: php-fpm:latest
    container_name: custom-app-1
    build:
      context: ./folder/
      dockerfile: ./docker/customappone.dockerfile
  (...)

  custom-app-2:
    profiles: ["custom2"]
    image: php-fpm:latest
    container_name: custom-app-2
    build:
      context: ./folder/
      dockerfile: ./docker/customapptwo.dockerfile
  (...)

  custom-app-3:
    profiles: ["custom3"]
    image: php-fpm:latest
    container_name: custom-app-1
    build:
      context: ./folder/
      dockerfile: ./docker/customappthree.dockerfile
  (...)

Describe the results you received:
Result from docker compose --profile dev --profile rabbit up

❯ docker compose --profile dev --profile rabbit up 
 ⠿ Container custom-app-2       Running   0.0s
 ⠿ Container mysql              Running   0.0s
 ⠿ Container custom-app-3       Running   0.0s
 ⠿ Container rabbitmq           Running   0.0s
 ⠿ Container custom-app-1       Running   0.0s
 ⠿ Container php-fpm            Running   0.0s
 ⠿ Container custom-app-4       Running   0.0s
 ⠿ Container redis              Running   0.0s
 ⠿ Container nginx              Running   0.0s

Describe the results you expected:
Result from docker compose --profile dev --profile rabbit up

❯ docker compose --profile dev --profile rabbit up 
 ⠿ Container nginx              Running   0.0s
 ⠿ Container mysql              Running   0.0s
 ⠿ Container rabbitmq           Running   0.0s
 ⠿ Container php-fpm            Running   0.0s
 ⠿ Container redis              Running   0.0s

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

Client:
 Cloud integration: 1.0.14
 Version:           20.10.6
 API version:       1.41
 Go version:        go1.16.3
 Git commit:        370c289
 Built:             Fri Apr  9 22:46:57 2021
 OS/Arch:           darwin/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.6
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       8728dd2
  Built:            Fri Apr  9 22:44:56 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.4
  GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Output of docker context show:
You can also run docker context inspect context-name to give us more details but don't forget to remove sensitive content.

[
    {
        "Name": "default",
        "Metadata": {
            "StackOrchestrator": "swarm"
        },
        "Endpoints": {
            "docker": {
                "Host": "unix:///var/run/docker.sock",
                "SkipTLSVerify": false
            },
            "kubernetes": {
                "Host": "https://XX.XX.XX.XX",
                "SkipTLSVerify": false,
                "DefaultNamespace": "default",
                "AuthProvider": {
                    "name": "gcp",
                    "config": {
                        "access-token": "xptoLonghash",
                        "cmd-args": "config config-helper --format=json",
                        "cmd-path": "/Users/xpto/google-cloud-sdk/bin/gcloud",
                        "expiry": "2021-04-30T15:36:13Z",
                        "expiry-key": "{.credential.token_expiry}",
                        "token-key": "{.credential.access_token}"
                    }
                }
            }
        },
        "TLSMaterial": {
            "kubernetes": [
                "ca.pem"
            ]
        },
        "Storage": {
            "MetadataPath": "\u003cIN MEMORY\u003e",
            "TLSPath": "\u003cIN MEMORY\u003e"
        }
    }
]

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
  compose: Docker Compose (Docker Inc., 2.0.0-beta.1)
  scan: Docker Scan (Docker Inc., v0.6.0)

Server:
 Containers: 10
  Running: 1
  Paused: 0
  Stopped: 9
 Images: 18
 Server Version: 20.10.6
 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: 05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc version: 12644e614e25b05da6fd08a38ffa0cfe1903fdec
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.10.25-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 4.823GiB
 Name: docker-desktop
 ID: PBJC:VSVM:4ZPS:IFGQ:6T7Z:W55H:HPNE:U3CF:IMZ2:GRZR:JKZ2:SPKE
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Additional environment details (AWS ECS, Azure ACI, local, etc.):
Local environment

ProductName:	Mac OS X
ProductVersion:	10.15.7
BuildVersion:	19H1030
@ndeloof ndeloof self-assigned this May 5, 2021
@ndeloof ndeloof added bug 🐞 App is not working correctly. compatibility Compatibility with docker-compose compose and removed compatibility Compatibility with docker-compose labels May 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug 🐞 App is not working correctly.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants