docker-machine: command not found - docker

I recently upgraded Docker Desktop for Mac to version 2.2.0.0, and now when try to run a docker-machine command I am getting an error:
$ docker-machine --version
docker-machine: command not found
Docker Machine used to be installed with Docker, but it appears in the latest docs that this is no longer the case. What is the replacement or do I need to install Docker Machine from somewhere else?

Docker machine has been removed from later versions of Docker Desktop. Your going to need the docker-toolbox package.
Read here for install and co existence of the packages.
https://docs.docker.com/docker-for-mac/docker-toolbox/#docker-toolbox-and-docker-desktop-coexistence

For Windows, if you have chocolatey installed, you follow the steps:
open a command shell with "Run as Administrator" selected (I tested this on my work laptop).
run "choco install docker-machine"

Docker machine is now merged into the docker command, So instead of using
docker-machine init
Use
docker swarm init
And instead of
docker-machine join
Use
docker swarm join
for more command just use this:
docker swarm --help

If you already have docker-desktop & want the docker-machine command, then brew install docker-machine does the trick.
My versions of the binaries in usr/local/bin/docker and usr/local/bin/docker-compose did not change, & the version of the docker client & server, but I got the docker-machine binary extra.
run unset ${!DOCKER_*} if you want to use docker-desktop.
The docker docs are a bit confusing because they seem to address the case where you have docker-machine first, not the case where you have desktop first.

You basically need to install Docker Machine first on your local machine. Reference :- https://github.com/docker/machine/releases
$ curl -L https://github.com/docker/machine/releases/download/v0.16.0/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine &&
chmod +x /tmp/docker-machine &&
sudo cp /tmp/docker-machine /usr/local/bin/docker-machine

Try and run this command on bash:
curl -L https://github.com/docker/machine/releases/download/v0.16.0/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine && chmod +x /tmp/docker-machine && sudo cp /tmp/docker-machine /usr/local/bin/docker-machine
Click here to know more about docker-machine installation
It worked for me.

Did you try brew to install it as they removed docker-machine from v2.2.0?
brew install docker-machine

Try this (both inside, and outside of container):
ss -nputl

Related

Error with pre-create check: "VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path"

i run CentOS in VirtualBox on physical Windows7. Now in centOS i have Docker and i need to run
docker-machine create --driver virtualbox host1
but i get error
Error with pre-create check: "VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path"
so do i need to install VirtualBox once again and in the CentOS? If yes, how can i do that?
thanks lot
Yes you are absolutely correct. You need to install VirtualBox first of all.
You can do it by running yum install virtualbox for CentOS or
sudo apt-get install virtualbox for Ubuntu
Do so and then run your code and you will be good to go
It's an issue with permissions. You've installed docker as sudo. You need to run
sudo docker-machine create --driver virtualbox host1
OR
sudo docker-compose up
to get around this.
I faced the same error in Ubuntu 18.04 but I realized that I had installed docker-machine using command : sudo snap install docker.
However install docker-machine using :
$ curl -L https://github.com/docker/machine/releases/download/v0.13.0/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine && \
chmod +x /tmp/docker-machine && \
sudo cp /tmp/docker-machine /usr/local/bin/docker-machine
Check your installation :
$ docker-machine version
Then install virtualbox using :
$sudo apt install virtualbox
Now you can create the docker-machine using the command :
$ docker-machine create --driver virtualbox dev
Hope this helps.
Being more specific about install VirtualBox on Mac Mojavi.
After downloading the VirtualBox-6.0.6-130049-OSX.dmg, double-click to install
Go to your applications folder and you will find the virtualbox.pkg like this:
Click on it to complete the installation.
After install is complete, you should see VirtualBox in the applications folder like this:
Afterwards you should refresh your terminal and rerun your command.
docker-machine create --driver virtualbox local-docker.
try to execute with superuser:
sudo docker-machine create -d virtualbox myvm1
For those who are using windows you can open the powershell command shell as an administrator and run the command below:
PS C:\Windows/system32> choco install virtualbox
if you don't have choco you can install it using this the command below:
PS C:\Windows/system32>
Set-ExecutionPolicy Bypass -Scope Process -Force; `
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
You just need to install the virtualbox :
sudo apt-get install virtualbox
then run this command:
docker-machine create --driver virtualbox default
Reinstalled virtualbox
sudo snap remove virtualbox && sudo snap install virtualbox
Renamed VBoxManage to match casing
sudo ln -s /usr/local/bin/VBoxManage /usr/local/bin/vboxmanage
Reinstall Docker Machine with the command below.
base=https://github.com/docker/machine/releases/download/v0.16.0 &&
curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/tmp/docker-machine &&
sudo mv /tmp/docker-machine /usr/local/bin/docker-machine &&
chmod +x /usr/local/bin/docker-machine
Confirm the version and save scripts to /etc/bash_completion.d or /usr/local/etc/bash_completion.d
base=https://raw.githubusercontent.com/docker/machine/v0.16.0
for i in docker-machine-prompt.bash docker-machine-wrapper.bashdocker-machine.bash
do
sudo wget "$base/contrib/completion/bash/${i}" -P /etc/bash_completion.d
done
Rerun the command.
docker-machine create --driver virtualbox host1
1) Reinstall Virtualbox ... you can use this code : sudo apt-get install virtualbox
2) sudo docker-machine create --driver virtualbox default
Doing installation of Docker-Swarm using below steps:
$ base=https://github.com/docker/machine/releases/download/v0.16.0 &&
mkdir -p "$HOME/bin" &&
curl -L $base/docker-machine-Windows-x86_64.exe > "$HOME/bin/docker-machine.exe" &&
chmod +x "$HOME/bin/docker-machine.exe"
Steps with ERROR:
$ base=https://github.com/docker/machine/releases/download/v0.16.0
$ mkdir -p "$HOME/bin"
$ curl -L $base/docker-machine-Windows-x86_64.exe > "$HOME/bin/docker-machine.exe"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 623 100 623 0 0 1236 0 --:--:-- --:--:-- --:--:-- 1238
100 27.2M 100 27.2M 0 0 726k 0 0:00:38 0:00:38 --:--:-- 593k
$ chmod +x "$HOME/bin/docker-machine.exe"
$ docker-machine version
docker-machine.exe version 0.16.0, build 702c****
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
$ docker-machine create --driver virtualbox manager1
Creating CA: C:\Users\*****\.docker\machine\certs\ca.pem
Creating client certificate: C:\Users\*****\.docker\machine\certs\cert.pem
Running pre-create checks...
Error with pre-create check: "VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path"
Resolution:
Then I installed VM from below link:Install VirtualBox
Download VirtualBox and the corresponding Extension Pack: https://www.virtualbox.org/wiki/Downloads
Install VirtualBox with the default settings
Add the Extension Pack to VirtualBox (File -> Preferences -> Extensions)
$ docker-machine create --driver virtualbox manager1
Running pre-create checks...
Error with pre-create check: "This computer is running Hyper-V. VirtualBox won't boot a 64bits VM when Hyper-V is activated.
Either use Hyper-V as a driver, or disable the Hyper-V hypervisor. (To skip this check, use --virtualbox-no-vtx-check)"
Then finally its created with below command:
$ docker-machine create --driver virtualbox --virtualbox-no-vtx-check manager1
Running pre-create checks...
(manager1) Image cache directory does not exist, creating it at C:\Users\****\.docker\machine\cache...
(manager1) No default Boot2Docker ISO found locally, downloading the latest release...
(manager1) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100%
(manager1) Creating VirtualBox VM...
(manager1) Creating SSH key...
(manager1) Starting the VM...
Also, if you installed virtualbox and vboxmanage on VM and still getting the same error:
Make sure your user is in the docker group. Otherwise you run docker as root and vbox as user and they can't see each other. Telltale sign that you're not in the group is that you have to sudo docker commands, e.g.:
sudo docker images
To fix, do:
sudo groupadd docker
sudo gpasswd -a <your-username> docker
Now check that user is added:
getent group docker
or:
grep /etc/group -e "docker"
Also restart docker daemon:
sudo service docker restart
Log out and back into terminal (try restarting system if this does not work), and you should be able to run docker without sudo, e.g.:
docker images
docker machine and docker-compose should now run, too.
Fore more information, refer to this answer: Can't connect to docker from docker-compose

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

Docker - Error response from daemon: client is newer than server

After creating a new machine with Docker Machine, I'm getting the following error:
$ docker ps
Error response from daemon: client is newer than server(client API version 1.21, server API version: 1.19)
How can I fix this?
docker-machine upgrade <your-machine>
will do the trick. This can happen - as it did for me - even if you're not using RCs and your machine was newly created. It would be due to an ISO cache issue. The error is commented in this thread.
If the docker client is 1.9.x and the server is running docker 1.8.x,
the error message is observed.
If someone happens to get this error, but is not using docker-machine, there is another way to resolve the issue by specifying an older API version in an environment variable on the client side:
export DOCKER_API_VERSION=<version>
for example:
export DOCKER_API_VERSION=1.19
and retrying the docker command.
Reference.
On ubuntu distrib it happens after an apt update, if docker run as a service.
The client is updated but the old version of the server is still running.
In this case just do a:
sudo service docker restart
If you upgrade your docker client you will not be able to use old docker-machine VMs. Actually you can force an upgrade with docker-machine upgrade vm-name, but if you are working with other distros (except boot2docker) as docker host like coreos, atomic, rancheros it may fail.
I am using Carina to manage more than one docker client version.
just install with $ curl -sL https://download.getcarina.com/dvm/latest/install.sh | sh
(linux and mac installation) and run dvm ls to list installed versions, dvm install 1.9.0 to install versions and dvm use 1.8.1 to change your client version.
Very easy and powerfull. =)
Atention, for your safety always take a look inside scripts downloaded from internet before running them.
Hope it helps
Apparently this error is due to docker-machine "falling asleep". Here is the magic command solving it for me:
$ docker-machine restart default
Or replace default by the name of your machine.
The result is:
$ docker-machine restart default
Restarting "default"...
Restarted machines may have new IP addresses. You may need to re-run the `docker-machine env` command.
As suggested, you may need to:
$ docker-machine env default
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://....."
export DOCKER_CERT_PATH=".../.docker/machine/machines/default"
export DOCKER_MACHINE_NAME="default"
# Run this command to configure your shell:
# eval $(docker-machine env default)
And so you finally run that command:
$ eval $(docker-machine env default)
From now it should work.
I had the same issue with 1.10.0-rc4, and it turned out that boot2docker wasn't updated properly when installing a newer Docker Toolbox. I had to remove boot2docker manually:
sudo rm -rf /usr/local/share/boot2docker
You can also delete the rest of the toolbox:
sudo rm -rf /usr/local/bin/docker*
sudo rm -rf /Applications/Docker
And finally install Docker Toolbox of the desired version.
Please see official uninstall script for on GitHub for OS X here.

Docker-compose does not install or run properly on boot2docker

I have successfully installed docker-machine on my Windows computer, and I'm able to use the Docker CLI on my windows box to run docker commands on a boot2docker VM.
I have docker-machine version 0.2.0, and docker 1.6.2, and the VM yields "4.0.3-boot2docker" when I run "uname -r" on it.
Now I want to install docker-compose to manage that boot2docker VM. Does docker-compose run on my Windows machine and manage the VM "remotely", as docker does, or do I have to install it on the VM itself?
On a related note, I tried installing docker-compose on my VM by doing the following:
C:\ docker-machine ssh dev
$ whoami
docker
$ sudo -i
# curl -L https://github.com/docker/compose/releases/download/1.2.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
# chmod +x /usr/local/bin/docker-compose
# exit
$ which docker
/usr/local/bin/docker
$ which docker-compose
/usr/local/bin/docker-compose
This is fine, but when I try to run docker-compose it doesn't work.
$ docker-compose up
-sh: docker-compose: not found
The file is in /usr/local/bin, and it has exactly the same privileges as docker.
docker#dev:/usr/local/bin$ ls -al do*
-rwxr-xr-x 1 root root 15443675 May 13 21:24 docker
-rwxr-xr-x 1 root root 5263681 May 19 00:09 docker-compose
docker#dev:/usr/local/bin$
Is there something I'm missing?
Have a good look at the curl output. It seems that the download url is not valid anymore. I found that
curl -L https://github.com/docker/compose/releases/download/1.2.0/docker-compose-Linux-x86_x64
gave
{"error":"Not Found"}
For me, the current release 1.3.2 worked well, i.e.:
curl -L https://github.com/docker/compose/releases/download/1.3.2/docker-compose-Linux-x86_x64
NOTE: When using on current CoreOS don't try to output in /usr/local/bin/docker-compose as noted here. Instead use /opt/bin/docker-compose (dir may need to be created first), i.e.
mkdir -p /opt/bin
curl -L https://github.com/docker/compose/releases/download/1.3.2/docker-compose-Linux-x86_x64 > /opt/bin/docker-compose
I found that the download links don't work for older versions and the "install" fails silently resulting in the problem you describe. Have a look to find a download link to a current version here:
https://github.com/docker/compose/releases
Like mkoertgen said, you can always view the output from the curl command in the terminal to see that you don't get "not found" or something similar or run cat /usr/local/bin/docker-compose to verify that it's not a textfile containing "not found".
You can install docker-compose on your Windows host too.
It will manage your docker remotely. You can think of docker-compose as a more abstract interface to docker.
After running boot2docker init, run boot2docker shellinit | Invoke-Expression. This will tell docker and docker-compose where the docker server is running.
More info on installing it on Windows can be found here: http://docs.docker.com/installation/windows/

dial unix /var/run/docker.sock: no such file or directory after upgrading to lxc-docker

when I installed docker initially, it shows to be of version 1.0.1
Being, that the current version is 1.4.1, I found and executed the following instructions:
$ sudo apt-get update
$ sudo apt-get install docker.io
$ sudo ln -sf /usr/bin/docker.io /usr/local/bin/docker
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
$ sudo sh -c "echo deb https://get.docker.io/ubuntu docker main \
> /etc/apt/sources.list.d/docker.list"
$ sudo apt-get update
$ sudo apt-get install lxc-docker
Now, when I run docker version I get 1.4.1, but docker no longer works - it gives me this error:
root#8dedd2fff58e:/# docker version
Client version: 1.4.1
Client API version: 1.16
Go version (client): go1.3.3
Git commit (client): 5bc2ff8
OS/Arch (client): linux/amd64
FATA[0000] Get http:///var/run/docker.sock/v1.16/version: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?
What can I do to fox this, but retail the most current docker verion 1.4.1?
/var/run/docker will be created when you start the docker service:
systemd:
sudo systemctl start docker
upstart:
sudo service docker start
init.d:
sudo /etc/init.d/docker start
You might also need this if you get this error:
FATA[0000] Cannot connect to the Docker daemon. Is 'docker -d' running on this host?
I had the same issue on Mac OS X. Leaving my fix here in case it helps somebody:
Run the "Docker Quick Start Terminal"
In the target-directory, run eval "$(docker-machine env default)"
This fixes the issue for me
I was experiencing the same problem and I was able to find the solution here: https://docs.docker.com/articles/basics/.
It's always good to go back to foundations.
The problem is that you might be running on a different port instead of default socket (unix:///var/run/docker.sock).
If you run "ps aux | grep docker" you should see the daemon running. At the end of the line of the docker process you should also see a parameter -H={IpAddress}:{Port}. You should also see the path were the certificates are stored (--tls parameters)
You have to instruct docker to connect to the tcp address specified in the -H parameter.
For example:
`docker --tls -H tcp://{IpAddress}:{Port} version`
Notice the --tls parameter, this is necessary if you instructed docker to run in a secure mode.
You could avoid the verbosity of the command by setting environment variables.
export DOCKER_HOST="tcp://{IpAddress}:{Port}"
export DOCKER_TLS_VERIFY="1"
Hope this helps..
Is docker initiated as a daemon?
use service docker.io status or service docker status
if not then start it and play with it
On a fresh M1 MacBook I ran into this. Amazingly the solution was to simply log in to the app using my docker account details. Once I did that I re-ran the failed command and it worked.

Resources