compose icon indicating copy to clipboard operation
compose copied to clipboard

docker-compose -H does not work with compose 2.11.0

Open niklas-rittmann opened this issue 3 years ago • 9 comments


BUG REPORT INFORMATION

Description

The remote socket support stopped working with compose 2.11.0.

Steps to reproduce the issue:

  1. Create an example docker-compose file
  2. Try to start the container at a remote host using docker-compose -H ssh://<<Remote host to deploy at>> up

Describe the results you received: Instead of deploying to the remote server it deploys on the localhost.

Describe the results you expected: Deploy the container on the remote host.

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

Using DOCKER_HOST=ssh://<<Remote host to deploy at>> docker-compose up still works as expected.

Output of docker compose version:

Docker Compose version v2.11.0

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.11.0)                                                                                                                                                
                                                                                                                                                                                                
Server:                                                                                                                                                                                                                                                                                                                                                                    
 Server Version: 20.10.18                                                                                                                                                                       
 Storage Driver: overlay2                                                                                                                                                                          

Additional environment details:

niklas-rittmann avatar Sep 16 '22 13:09 niklas-rittmann

@ulyssessouza looks like this was introduced in https://github.com/docker/compose/pull/9817. Can you take a look?

laurazard avatar Sep 19 '22 13:09 laurazard

I'm unsure if this is related, but I'm having similar issues with the --context option:

This lists my remote containers:

docker --context my_context ps

This does not:

docker --context my_context compose -p my_fixed_project_name ps

sphinxc0re avatar Sep 19 '22 14:09 sphinxc0re

Don’t know if this helps but: docker -H <<Remote host>> compose up also does not work.

niklas-rittmann avatar Sep 19 '22 14:09 niklas-rittmann

This makes compose unusable for me.

sphinxc0re avatar Sep 19 '22 14:09 sphinxc0re

@sphinxc0re in the meantime, as mentioned by @niklas-rittmann, you can use DOCKER_HOST=ssh://<<Remote host>> docker compose [xxx] to circumvent this issue.

laurazard avatar Sep 19 '22 14:09 laurazard

Nope, this does not work either.

sphinxc0re avatar Sep 19 '22 14:09 sphinxc0re

@sphinxc0re Strange, I tested this on two separate machines + using the docker image and on all machines it seemed to work just fine.

niklas-rittmann avatar Sep 19 '22 15:09 niklas-rittmann

Just tested this again with -p my_project_name specified. The workaround works now.

sphinxc0re avatar Sep 19 '22 15:09 sphinxc0re

Also doesn't work for me

(venv) kaan@ubuntu-vm:~/Desktop/DjangoProject$ DOCKER_HOST=ssh://[email protected] docker compose  -f docker-compose.base.yml -f deploy/docker-compose.yml --env-file deploy/env_file ps

Cannot connect to the Docker daemon at http://docker.example.com. Is the docker daemon running?

quick edit, it was due to bad permissions on remote host, this line works

DOCKER_HOST=ssh://[email protected] docker compose  -f docker-compose.base.yml -f deploy/docker-compose.yml --env-file deploy/env_file ps

it doesn't display the correct error when the permissions are wrong so its a little misleading. This is what I did to enable docker for ubuntu user


      groupadd docker
      usermod -aG docker ubuntu
      chown root:docker /var/run/docker.sock
      chown -R root:docker /var/run/docker

kaangoksal avatar Sep 20 '22 03:09 kaangoksal

This is fixed by #9871, which will be in the next Compose release (which I'm in the process of tagging 🙂).

milas avatar Sep 27 '22 13:09 milas