docker-compose up re-creates container when it shouldn't (original) (raw)
Description
Hello, I have the following test.yml:
version: "3.2"
services:
rabbitmq:
image: rabbitmq:3-management-alpine
container_name: 'rabbitmq'
ports:
- 5672:5672
- 15672:15672
Running docker-compose -p test-container -f test.yaml up -d
leads to image pulling and creating container
However, the second run of the same docker-compose -p test-container -f test.yaml up -d
command without any changes in test.yaml file leads to container re-creation:
It, seems to be unexpected because all subsequent runs of the same command do not recreate the container:
Steps to reproduce the issue:
- Create docker-compose.yaml file with any image that is not presented locally and should be pulled first (rabbit-mq was used as example)
- run docker-compose up for the first time (it pulls and creates the container)
- run docker-compose up for the second time
Describe the results you received:
The second run recreates container, which was created
Describe the results you expected:
As far as I undestand the container should not be recreated because the configuration has not been changed plus all subsequent runs of the same command do not recreate the container
Additional information you deem important (e.g. issue happens only occasionally):
- The issue is reproduced exactly at the second run of
docker-compose up
command after pulling image that is not presented locally. - The benavior does not depend on the image used in test.yaml file (as far as I noticed the only precondition is that the first run of docker-compose up pulls an image and as a result, only the next run recreates container )
Output of docker compose version
:
Docker Compose version v2.10.2
Output of docker info
:
Client:
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc., v0.9.1)
compose: Docker Compose (Docker Inc., v2.10.2)
extension: Manages Docker extensions (Docker Inc., v0.2.9)
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
scan: Docker Scan (Docker Inc., v0.19.0)
Server:
Containers: 1
Running: 1
Paused: 0
Stopped: 0
Images: 210
Server Version: 20.10.17
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: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc version: v1.1.4-0-g5fd4c4d
init version: de40ad0
Security Options:
seccomp
Profile: default
Kernel Version: 5.10.102.1-microsoft-standard-WSL2
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 3.832GiB
Name: docker-desktop
ID: 4RBP:FM7U:MTXJ:Q4B2:72WV:EDCU:74LD:VWZZ:K7S4:JE3Z:OXML:XXCH
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
Additional environment details: