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

Install docker-compose v2.x system-wide #8687

Closed
aminvakil opened this issue Sep 28, 2021 · 14 comments · Fixed by #8692
Closed

Install docker-compose v2.x system-wide #8687

aminvakil opened this issue Sep 28, 2021 · 14 comments · Fixed by #8692

Comments

@aminvakil
Copy link
Contributor

Description

How to install docker-compose v2.x system-wide instead of copying it into each users' home?

Steps to reproduce the issue:

  1. Download latest docker-compose release (which is 2.0.0 now).
  2. Copy it to /usr/local/bin/docker-compose
  3. chmod +x /usr/local/bin/docker-compose

Describe the results you received:
None of docker-compose commands works. (docker-compose ps, docker-compose up, docker-compose down)
All of them returns:

# docker-compose up

Usage:  docker [OPTIONS] COMMAND

docker-compose is a Docker CLI plugin

Options:
      --config string      Location of client config files (default "/root/.docker")
  -c, --context string     Name of the context to use to connect to the daemon (overrides DOCKER_HOST
                           env var and default context set with "docker context use")
  -D, --debug              Enable debug mode
  -H, --host list          Daemon socket(s) to connect to
  -l, --log-level string   Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
      --tls                Use TLS; implied by --tlsverify
      --tlscacert string   Trust certs signed only by this CA (default "/root/.docker/ca.pem")
      --tlscert string     Path to TLS certificate file (default "/root/.docker/cert.pem")
      --tlskey string      Path to TLS key file (default "/root/.docker/key.pem")
      --tlsverify          Use TLS and verify the remote

Management Commands:
  completion                 generate the autocompletion script for the specified shell
  compose                    Docker Compose

Run 'docker COMMAND --help' for more information on a command.

To get more help with docker, check out our guides at https://docs.docker.com/go/guides/

Describe the results you expected:
Install it system wide and it works.

Output of docker compose version:

docker-compose version does not work, but I've installed 2.0.0.

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.6.1-docker)
  scan: Docker Scan (Docker Inc., v0.8.0)

Server:
 Containers: 2
  Running: 2
  Paused: 0
  Stopped: 0
 Images: 2
 Server Version: 20.10.8
 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: e25210fe30a0a703442421b0f60afac609f950a3
 runc version: v1.0.1-0-g4144b63
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.18.0-305.19.1.el8_4.x86_64
 Operating System: Rocky Linux 8.4 (Green Obsidian)
 OSType: linux
 Architecture: x86_64
 CPUs: 1
 Total Memory: 1.775GiB
 Name: hostname
 ID: OPO4:WFTW:WTD5:VTKN:NSLY:EHN6:2C6Y:5T3B:3XNK:QYIV:XTAV:EURV
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
@ndeloof
Copy link
Contributor

ndeloof commented Sep 28, 2021

docker compose V2 is a distinct architecture vs Compose V1
docker-compose is a Docker CLI plugin, should not be installed under /usr/local/bin but /usr/local/lib/docker/cli-plugins

@mat007
Copy link
Member

mat007 commented Sep 28, 2021

Maybe we should update the readme to mention /usr/local/lib/docker/cli-plugins?

@thaJeztah
Copy link
Member

Yes, there's a couple of locations to install it globally; if they didn't change between the proposal and implementation (docker/cli#1534);

Unix-like OSes :

  • $HOME/.docker/cli-plugins
  • /usr/local/lib/docker/cli-plugins & /usr/local/libexec/docker/cli-plugins
  • /usr/lib/docker/cli-plugins & /usr/libexec/docker/cli-plugins

On Windows:

  • %USERPROFILE%.docker\cli-plugins
  • C:\ProgramData\Docker\cli-plugins

@amigthea
Copy link

* /usr/lib/docker/cli-plugins & /usr/libexec/docker/cli-plugins

so I have to download docker-compose in both directories?

@ndeloof
Copy link
Contributor

ndeloof commented Sep 28, 2021

nope, one of those

@amigthea
Copy link

nope, one of those

did, so I think I have to restart docker right?

@ndeloof
Copy link
Contributor

ndeloof commented Sep 28, 2021

no you don't have to, this is all taking place on the CLI side
Try docker compose version

@amigthea
Copy link

amigthea commented Sep 28, 2021

no you don't have to, this is all taking place on the CLI side Try docker compose version

it works flawlessly, thank you for your kind support

@ndeloof ndeloof closed this as completed Sep 28, 2021
@amigthea
Copy link

one last thing, there's a way to enable the autocompletition on the new docker compose ? I got the completition for docker run, docker exec, etc. but not for compose

@mat007
Copy link
Member

mat007 commented Sep 28, 2021

This needs support from the docker CLI binary, it will be available with the next release of the Docker CLI package.
Or you can build it yourself from https://github.com/docker/cli/

@nemchik
Copy link

nemchik commented Sep 28, 2021

Will there be an option to use something like docker plugin install compose ?

@mat007
Copy link
Member

mat007 commented Sep 28, 2021

It will be distributed with the docker CLI, most likely.

@aminvakil
Copy link
Contributor Author

Maybe we should update the readme to mention /usr/local/lib/docker/cli-plugins?

I will create a PR for this if that's OK.

@guillaumerose
Copy link
Contributor

It would be useful to add these instructions to the official documentation (https://docs.docker.com/compose/cli-command/#install-on-linux)

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

Successfully merging a pull request may close this issue.

7 participants