"gcloud auth configure-docker" on GCP VM instance with Ubuntu not setup properly? - docker

I created a VM instance on GCP using Ubuntu 18.10. When I SSH the VM without any modification and try:
gcloud info
I got some Warning:
System PATH: [/snap/google-cloud-sdk/66/usr/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/game
s:/snap/bin]
Python PATH: [/snap/google-cloud-sdk/66/lib/third_party:/snap/google-cloud-sdk/66/lib:/snap/google-cloud-sdk/66/usr/lib/python2.7/:/snap
/google-cloud-sdk/66/usr/lib/python2.7/plat-x86_64-linux-gnu:/snap/google-cloud-sdk/66/usr/lib/python2.7/lib-tk:/snap/google-cloud-sdk/6
6/usr/lib/python2.7/lib-old:/snap/google-cloud-sdk/66/usr/lib/python2.7/lib-dynload]
Cloud SDK on PATH: [False]
Kubectl on PATH: [False]
WARNING: There are old versions of the Google Cloud Platform tools on your system PATH.
/usr/bin/snap
If I try to authenticate with:
sudo gcloud auth configure-docker
I see:
WARNING: `docker-credential-gcloud` not in system PATH.
gcloud's Docker credential helper can be configured but it will not work until this is corrected.
WARNING: `docker` not in the system PATH.
`docker` and `docker-credential-gcloud` need to be in same PATH in order to work correctly together.
gcloud's Docker credential helper can be configured but it will not work until this is corrected.
The following settings will be added to your Docker config file
It seems that a quite recent version of gcloud is installed:
sudo gcloud version
Google Cloud SDK 230.0.0
alpha 2019.01.11
beta 2019.01.11
bq 2.0.39
core 2019.01.11
gsutil 4.35
kubectl 2019.01.11
It doesn't seem I am allowed to update gcloud on such instance.
Then I installed Docker and pulled a docker image.
sudo snap install docker
sudo docker pull tensorflow/serving
This is working fine.
The issue is that I cannot push the image on GCP Container Registry:
sudo docker tag tensorflow/serving gcr.io/xxx/tf-serving
sudo docker push gcr.io/xxx/tf-serving
Unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request
st, follow the steps in https://cloud.google.com/container-registry/docs/advanced-authentication
and in the link it is explained that I need to run:
sudo gcloud auth configure-docker
How do I fix the issue? The issue is already present when I SSH the VM ?
WARNING: `docker-credential-gcloud` not in system PATH.
I can push the image on DockerHub without any issue.
I tried to reinstall google-cloud-sdk:
sudo apt-get update && sudo apt-get install google-cloud-sdk
But now I need to use:
sudo gcloud alpha auth configure-docker
and the end I still cannot push the image.
It seems to be related to some path issue:
Cloud SDK on PATH: [False]
Kubectl on PATH: [False]
WARNING: There are old versions of the Google Cloud Platform tools on your system PATH.
/usr/bin/snap
Any idea? I did follow the GCP documentation step by step. I also look at GCP IAM to grant some access on my bucket.
I am new on GCP and Cloud so I am probably missing something obvious. By the way, I need to build a Docker image using a shell script so I need to use such type of VM because on the other VM for which a lot of stuff is already pre-installed are mounted with "noexec" flag.

The Snap package contains docker-credential-gcloud in /snap/google-cloud-sdk/current/bin/. You can symlink it to /usr/local/bin using:
sudo ln -s /snap/google-cloud-sdk/current/bin/docker-credential-gcloud /usr/local/bin
After that, pushing Docker images to Google Container Registry (gcr.io) works fine.
I also tried sudo snap alias google-cloud-sdk.docker-credential-gcloud docker-credential-gcloud to create a symlink similar to the one for gcloud itself. But that failed with the following error:
error: cannot perform the following tasks:
- Setup manual alias "docker-credential-gcloud" => "docker-credential-gcloud" for snap "google-cloud-sdk" (cannot enable alias "docker-credential-gcloud" for "google-cloud-sdk", target application "docker-credential-gcloud" does not exist)

Here is what is now working (thanks Google for the help)
Setup:
Choose Ubuntu 18.10 (GNU/Linux 4.18.0-1005-gcp x86_64)
add 20 GB disk + allow http and http
set access for each API -> Storage : Read Write
sudo snap remove google-cloud-sdk
curl https://sdk.cloud.google.com | bash
reconnect to the VM
install docker https://docs.docker.com/install/linux/docker-ce/ubuntu/
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo docker run hello-world # test
sudo usermod -a -G docker LOGIN
reconnect to the VM
gcloud auth configure-docker
testing docker pull/push on GCP
docker pull tensorflow/serving
docker tag tensorflow/serving gcr.io/BUCKET_NAME/tf-serving
docker push gcr.io/BUCKET_NAME/tf-serving
(if you don't give write access when creating the VM: use "gcloud auth login")
now this works

the issue might be that snap install; just remove /snap/google-cloud-sdk from the system. or check which gcloud to see which one is even used. the apt version does not seem to have these docker packages available - and also, the $PATH only lists that snap version.
ordinary, components can be updated with:
gcloud components update
or listed:
gcloud components list
or installed:
gcloud components install docker-credential-gcr
would suggest to simply install the stand-alone version with:
curl https://sdk.cloud.google.com | bash
after having removed the snap and apt version, from file-system and $PATH.

Related

docker compose inside docker in docker

What I have:
I am creating a Jenkins(BlueOcean Pipeline) for CI/CD. I am using the docker in docker approach to use Jenkins as described in the Jenkins docs tutorail.
I have tested the setup, it is working fine. I can build and run docker images in the Jenkins container. Now, I am trying to use docker-compose, but it says docker-compose: not found
`
Problem:
Unable to use `docker-compose inside the container(Jenkins).
What I want:
I want to able to use `docker-compose inside the container using the dind(docker in docker) approach.
Any help would be very much appreciated.
Here is my working solution:
FROM maven:3.6-jdk-8
USER root
RUN apt update -y
RUN apt install -y curl
# Install Docker
RUN curl https://get.docker.com/builds/Linux/x86_64/docker-latest.tgz | tar xvz -C /tmp/ && mv /tmp/docker/docker /usr/bin/docker
# Install Docker Compose
RUN curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/bin/docker-compose
# Here your customizations...
It seems docker-compose is not installed in that machine.
You can check if docker-compose is installed or not using docker-compose --version. If it is not installed then you can install it in below way :
Using apt- package manager : sudo apt install -y docker-compose
OR
Using python install manager : sudo pip install docker-compose

Unable to install docker on AWS Linux AMI

I followed the steps to install docker on my EC2 instance which is based on Amazon AMI using the instructions from the official link - official docker installation on centos. I am getting the below error.
$ sudo yum update
........
$ sudo yum install docker-ce docker-ce-cli containerd.io
........
--------> Finished Dependency Resolution
Error: Package: 3:docker-ce-19.03.8-3.el7.x86_64 (docker-ce-stable)
Requires: systemd
Error: Package: 3:docker-ce-19.03.8-3.el7.x86_64 (docker-ce-stable)
Requires: libsystemd.so.0(LIBSYSTEMD_209)(64bit)
Error: Package: 3:docker-ce-19.03.8-3.el7.x86_64 (docker-ce-stable)
Requires: container-selinux >= 2:2.74
Error: Package: containerd.io-1.2.13-3.1.el7.x86_64 (docker-ce-stable)
Requires: systemd
Error: Package: 3:docker-ce-19.03.8-3.el7.x86_64 (docker-ce-stable)
Requires: libsystemd.so.0()(64bit)
Error: Package: containerd.io-1.2.13-3.1.el7.x86_64 (docker-ce-stable)
Requires: container-selinux >= 2:2.74
Where am I going wrong?
Solution in context of the image - Amazon Linux 2 AMI
One may need to remove the packages they installed using docker provided links
use the command here to remove all of that:-
sudo rm /etc/yum.repos.d/docker-ce.repo
And use the link given by AWS to install the docker here - https://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html
The content for that commands in that link are as below:-
Connect to your instance(Amazon Linux 2 AMI).
Update the installed packages and package cache on your instance.
sudo yum update -y
Install the most recent Docker Community Edition package.
sudo amazon-linux-extras install docker
Start the Docker service.
sudo service docker start
Add the ec2-user to the docker group so you can execute Docker commands without using sudo.
sudo usermod -a -G docker ec2-user
Log out and log back in again to pick up the new docker group permissions. You can accomplish this by closing your current SSH terminal window and reconnecting to your instance in a new one. Your new SSH session will have the appropriate docker group permissions.
Verify that the ec2-user can run Docker commands without sudo.
docker info
Use amazon-linux-extras to install docker
# install
sudo rm /etc/yum.repos.d/docker-ce.repo # if you have already tried in the wrong way
sudo amazon-linux-extras install docker
# enable on boot and start daemon
sudo systemctl enable docker
sudo systemctl start docker
# correct permissions
sudo usermod -a -G docker $USER
newgrp docker
docker ps
Amazon AMI best practices are to use their install procedures. You, of course, are at your liberty to do what best fits your needs:
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html
Figured it out because I had a similar issue an hour ago, and just realized I was doing it wrong:
https://serverfault.com/questions/836198/how-to-install-docker-on-aws-ec2-instance-with-ami-ce-ee-update
I installed docker using below link. May this be helping others
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html

Installed docker and I got podman

Installed docker on Centos (running using VirtualBox) following steps below:
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum install docker
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
And I rebooted my virtual machine, and as I type 'docker --version, I get below:
"Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg. podman version 1.0.5"
Can anybody explain what is going on in my machine?
#swxraft if you run the commands in the order posted in your question
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum install docker
sudo yum-config-manager --add-repo
https://download.docker.com/linux/centos/docker-ce.repo
you installed a docker in the REHL repo (probably an alias to podman). And then loaded the repo for the oficial docker but never installed from there.
Extra info:
A) installation docker
How to install docker: follow this link [1] instead #govinda-malavipathirana. Latest docker-ce needs a newer containerd.io but REHL is excluding the ones in the docker repo. So you need to install docker -ce with --nobest (see instructions and error in link). Also you need to disable the firewall.d to have DNS in docker.
B) why docker is not in REHL8
Docker cli and daemon are not supported by REHL8 and its derivatives and it is "blocked" in several ways. Why is not suported -> monolitic and old [2]
Docker images ARE supported using podman. The images created with docker work with podman and viceversa. Also podman commands are the same as docker client.
Podman is a substitute of docker (but it does not use a daemon). They recommend to add a symlink docker -> podman and you will not notice the difference [3]
[1]https://linuxconfig.org/how-to-install-docker-in-rhel-8
[2]http://crunchtools.com/why-no-docker/
[3]https://developers.redhat.com/blog/2019/02/21/podman-and-buildah-for-docker-users/
Docker will not support RedHat 8, it will be installed as Podman.
So you can try it with Amazon linux2 instead of RedHat.
You have to create a new instance in AWS with Amazon linux2, then it will work.
Since docker is not officially supported by REHL8/CentOS8. You have to install it by additional steps.
This is a good article I have found in the internet, shows how to install docker in CentOS 8.
https://computingforgeeks.com/install-docker-and-docker-compose-on-rhel-8-centos-8

Docker still show the version after after its purge

After several problems, I decided to purge Docker to reinstall it in a second time. Here's the steps that I did to purge all the packages related to Docker:
- dpkg -l | grep -i docker
- sudo apt-get purge docker-engine docker docker-compose
- sudo apt-get autoremove --purge docker docker-compose docker-engin
I even delete the folder which contains Docker files and containters /var/lib/docker
But I still display the docker version after all I did.
docker -v
Docker version 17.06.2-ce, build a04f55b
EDIT : This solution is for systems using Debian packages (Debian, Ubuntu, Mint, ...).
You saw that the docker binary is still present in your system.
You can locate it using the whereis command :
# whereis docker
docker: /usr/bin/docker /usr/lib/docker /etc/docker /usr/share/man/man1/docker.1.gz
Now that the binary is located (it's /usr/bin/docker in the example) you can use the dpkg -S <location> to look for its package. See related post.
# dpkg -S /usr/bin/docker
docker-ce: /usr/bin/docker
And then you can get rid of the package (here docker-ce) using your usual tools (apt-get purge, or dpkg -r if the package was not installed through a repository).
That version number looks like the last release of the snap package. If you installed by snap, then the uninstall uses the same tool:
sudo snap remove docker

Why is Docker installed but not Docker Compose?

I have installed docker on CentOS 7 by running following commands,
curl -sSL https://get.docker.com/ | sh
systemctl enable docker && systemctl start docker
docker run hello-world
NOTE: helloworld runs correctly and no issues.
however when I try to run docker-compose (docker-compose.yml exists and valid) it gives me the error on CentOS only (Windows version works fine for the docker-compose file)
/usr/local/bin/docker-compose: line 1: {error:Not Found}: command not found
You also need to install Docker Compose. See the manual. Here are the commands you need to execute
sudo curl -L "https://github.com/docker/compose/releases/download/v2.12.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo mv /usr/local/bin/docker-compose /usr/bin/docker-compose
sudo chmod +x /usr/bin/docker-compose
Note:
Make sure that the link pointing to the GitHub release is not outdated!. Check out the latest releases on GitHub.
I'm installing on a Raspberry Pi 3, with Raspbian 8. The curl method failed for me (got a line 1: Not: command not found error upon asking for docker-compose --version) and the solution of #sunapi386 seemed a little out-dated, so I tried this which worked:
First clean things up from previous efforts:
sudo rm /usr/local/bin/docker-compose
sudo pip uninstall docker-compose
Then follow this guidance re docker-compose on Rpi:
sudo apt-get -y install python-pip
sudo pip install docker-compose
For me (on 1 Nov 2017) this results in the following response to docker-compose --version:
docker-compose version 1.16.1, build 6d1ac219
If you installed docker by adding their official repository to your repository list, like:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
Just do:
$ sudo apt-get install docker-compose
In case on RHEL based distro / Fedora:
$ sudo dnf install docker-compose
UPDATE May 2022
Since April 2022 docker compose V2 is GA and it's now part of docker desktop. You can see all the related info here.
Compose V1 is now marked as deprecated.
Original answer:
docker compose v1 is a separate install. To install v1 follow instructions here.
docker compose v2 is currently a separate install but will be integrated into docker at some point, when it's ready. It has been conceived as a docker plugin. At this time, if you want docker compose v2, since this commit you can do:
sudo apt update \
&& sudo apt install docker-compose-plugin
with apt or the equivalent for yum. That will install the new docker compose V2 as a plugin.
If you're using ubuntu and docker compose works but docker-compose doesn't, and you need the old docker-compose syntax to be available (maybe a 3rd party library uses it) you can fix it by following these steps:
the docker-compose plugin is probably installed under /usr/libexec/docker/cli-plugins/docker-compose (make sure it is)
create a symlink to it:
sudo ln -s /usr/libexec/docker/cli-plugins/docker-compose /usr/bin/docker-compose
Now docker-compose should be available
Update:
If docker-compose is no where to be found on the mentioned path, you can download it manually from release page for your operating system and then move the downloaded file and make it executable.
cd ~/Downloads
sudo mv ./docker-compose-* /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
I'm on debian, I found something quite natural to do :
apt-get install docker-compose
and it did the job
(not tested on centos)
They changed the syntax. Now it is written like this:
docker compose [OPTIONS] COMMAND
docker compose ps
Now compose is plugin! But other doc pages have old syntax.
How I should support compatibility?!
UPDATE:
If you run script it can get compose command:
# docker-compose.sh
if docker compose version > /dev/null ; then
echo "docker compose"
else
echo "docker-compose"
fi
# other.sh
DOCKER_C=$($BASEDIR/docker-compose.sh)
echo "docker command is: $DOCKER_C"
Living on the crutches, thanks Docker command (:
I'm installing on a Raspberry Pi 3, on Raspbian OS. The curl method didn't resolve to a valid response. It also said {error: Not Found}, I took a look at the URL https://github.com/docker/compose/releases/download/1.11.2/docker-compose-Linux-armv7l and it was not valid. I guess there was no build there.
This guide https://github.com/hypriot/arm-compose worked for me.
sudo apt-get update
sudo apt-get install -y apt-transport-https
echo "deb https://packagecloud.io/Hypriot/Schatzkiste/debian/ jessie main" | sudo tee /etc/apt/sources.list.d/hypriot.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 37BBEE3F7AD95B3F
sudo apt-get update
sudo apt-get install docker-compose
first of all please check if docker-compose is installed,
$ docker-compose -v
If it is not installed, please refer to the installation guide https://docs.docker.com/compose/install/
If installed give executable permission to the binary.
$ chmod +x /usr/local/bin/docker-compose
check if this works.
Tried to install docker-compose on CentOS using curl per docker docs (for Linux). After those steps it returned an error
docker-compose -v
/usr/local/bin/docker-compose: line 1: Not: command not found
Funny thing docker-compose file literally contains just "Not Found" on line 1 (it should be a binary)
cat /usr/local/bin/docker-compose
Not Found
That means a github link I tried to curl from does not exist. My unsuccessful link was:
sudo curl -L "https://github.com/docker/compose/releases/download/2.2.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Running uname -s and uname -m locally you can see what needs to be added to a download url
uname -s
Linux
uname -m
x86_64
Trying the url in a browser
https://github.com/docker/compose/releases/download/2.2.2/docker-compose-linux-x86_64
shows that page was not found.
A problem they added "v" to a version, as in v2.2.2. So a download url should be with "v"
https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-linux-x86_64. Their releases: https://github.com/docker/compose/releases/
This worked (attention v2.2.2)
sudo curl -L "https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose -v
Docker Compose version v2.2.2
Refered to the answers given above (I do not have enough reputation to refer separately to individual solutions, hence I do this collectively in this place), I want to supplement them with some important suggestions:
docker-compose you can install from the repository (if you have this package in the repository, if not you can adding to system a repository with this package) or download binary with use curl - totourial on the official website of the project - src: https://docs.docker.com/compose/install /
docker-compose from the repository is in version 1.8.0 (at least at me). This docker-compose version does not support configuration files in version 3. It only has version = <2 support. Inthe official site of the project is a recommendation to use container configuration in version 3 - src: https://docs.docker.com/compose/compose-file / compose-versioning /. From my own experience with work in the docker I recommend using container configurations in version 3 - there are more configuration options to use than in versions <3. If you want to use the configurations configurations in version 3 you have to do update / install docker-compose to the version of at least 1.17 - preferably the latest stable. The official site of the project is toturial how to do this process - src: https://docs.docker.com/compose/install/
when you try to manually remove the old docker-compose binaries, you can have information about the missing file in the default path /usr/local/bin/docker-compose. At my case, docker-compose was in the default path /usr/bin/docker-compose. In this case, I suggest you use the find tool in your system to find binary file docker-compose - example syntax: sudo find / -name 'docker-compose'. It helped me. Thanks to this, I removed the old docker-compose version and added the stable to the system - I use the curl tool to download binary file docker-compose, putting it in the right path and giving it the right permissions - all this process has been described in the posts above.
Regards,
Adam
just use brew:
brew install docker-compose
A lot of suggestions for Ubuntu OS, but imho the easiest solution is to just create an alias. (if docker compose is already installed)
Steps:
ls -la inside your ~ directory to see if there is a .bash_aliases
if not just create it (touch, nano... or simply with gedit) gedit .bash_aliases
(the above steps can be skipped and just add your aliases inside .bashrc)
add the alias alias docker-compose="docker compose"
make the aliases available in your current session: source ~/.bashrc
The above solutions didn't work for me. But I found this that worked:
sudo apt-get update -y && sudo apt-get install -y python3-pip python3-dev
sudo apt-get remove docker docker-engine docker.io
curl -fsSL get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo pip3 install docker-compose
#sudo docker-compose -f docker-compose-profess.yml pull ofw
sudo usermod -a -G docker $USER
sudo reboot
For installing Docker Compose v1, you can install as following:
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
For installing Docker Compose v2, you can refer here.
For command compatibility between the new compose and the old docker-compose, you can refer here.
From the official docs:
If you installed Docker Desktop/Toolbox for either Windows or Mac, you
already have Docker Compose! Play-with-Docker instances already have
Docker Compose installed as well. If you are on a Linux machine, you
will need to install Docker Compose.
For that, you need to refer to the Pre-existing Docker Installation section.
Installing docker doesn't mean that you've installed docker-compose. It has as prerequisitions that you've already installed the docker engine which you've already done. After that you're able to install docker-compose following this link for Centos 7.
docker-compose is currently a tool that utilizes docker(-engine) but is not included in the distribution of docker.
Here is the link to the installation manual:
https://docs.docker.com/compose/install/
TL;DR:
curl -L https://github.com/docker/compose/releases/download/1.8.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/bin/docker-compose
(1.8.0 will change in the future)
I suggest using the official pkg on Mac. I guess docker-compose is no longer included with docker by default: https://docs.docker.com/toolbox/toolbox_install_mac/
On Linux, you can download the Docker Compose binary from the Compose repository release page on GitHub. Follow the instructions from the link, which involve running the curl command in your terminal to download the binaries. These step-by-step instructions are also included below.
1:Run this command to download the current stable release of Docker Compose:
sudo curl -L "https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
To install a different version of Compose, substitute 1.26.2 with the version of Compose you want to use.
2:Apply executable permissions to the binary:
sudo chmod +x /usr/local/bin/docker-compose
Note: If the command docker-compose fails after installation, check
your path. You can also create a symbolic link to /usr/bin or any
other directory in your path.
If you want to auto install docker-compose latest version, just run:
export docker_compose_latest=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/docker/compose/releases/latest | grep -o '[^/]*$')
curl -L "https://github.com/docker/compose/releases/download/${docker_compose_latest}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
It will install latest version of docker-compose. Official installing way need version obtained by your hands. But I wrote a script which obtain the latest version for you automatically.
In Amazon Linux, if you will do which docker-compose
you will get the below error
[root#ip bin]# which docker-compose
/usr/bin/which: no docker-compose in (/sbin:/bin:/usr/sbin:/usr/bin)
just mv the docker-compose from /usr/local/bin to /usr/bin
[root#ip bin]# mv docker-compose /usr/bin
[root#ip bin]# which docker-compose
/bin/docker-compose
[root#ip-172-31-36-121 bin]# docker-compose --version
docker-compose version 1.29.2, build unknown
Here is a brief guide that installs both Docker and Docker compose, hope you find it useful.
If docker-compose is already persists in /usr/local/bin:
ls -alt /usr/local/bin/ | grep docker-compose
> lrwxr-xr-x 1 root wheel 77 Mar 11 10:39 docker-compose -> /Applications/Docker.app/Contents/Resources/bin/docker-compose/docker-compose
Then update your .bash_profile Path with this /usr/local/bin in the end:
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH:/usr/local/bin"
Run:
source ~/.bash_profile
And check:
echo $PATH
> ...
which docker-compose
> /usr/local/bin/docker-compose
docker-compose

Resources