Skip to content

Instantly share code, notes, and snippets.

@lmakarov
Created June 30, 2015 16:47
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 14 You must be signed in to fork a gist
  • Save lmakarov/54302df8ecfc87b36320 to your computer and use it in GitHub Desktop.
Save lmakarov/54302df8ecfc87b36320 to your computer and use it in GitHub Desktop.
Install docker-compose in boot2docker 1.7.0+
#!/bin.sh
DOCKER_COMPOSE_VERSION=1.3.0
# Download docker-compose to the permanent storage
echo 'Downloading docker-compose to the permanent VM storage...'
sudo mkdir -p /var/lib/boot2docker/bin
sudo curl -sL https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` -o /var/lib/boot2docker/bin/docker-compose
sudo chmod +x /var/lib/boot2docker/bin/docker-compose
sudo ln -sf /var/lib/boot2docker/bin/docker-compose /usr/local/bin/docker-compose
# Making the symlink persistent via bootlocal.sh
echo 'Writing to bootlocal.sh to make docker-compose available on every boot...'
cat <<SCRIPT | sudo tee -a /var/lib/boot2docker/bootlocal.sh > /dev/null
# docker-compose
sudo ln -sf /var/lib/boot2docker/bin/docker-compose /usr/local/bin/docker-compose
SCRIPT
sudo chmod +x /var/lib/boot2docker/bootlocal.sh
echo 'Launching docker-compose...'
docker-compose --version
@lmakarov
Copy link
Author

Installation for VirtualBox:

docker-machine ssh <machine-name> < install-docker-compose.sh

Run docker-compose from the host:

docker-machine ssh <machine>  -- docker-compose --version

Check that docker-compose is available after a reboot:

docker-machine reboot <machine> 
docker-machine ssh <machine>  -- docker-compose --version

@colltoaction
Copy link

I have a suggestion for make things more transparent. It would be great if we could:

  • Alias the command to docker-compose
  • Pass the current path from the host to the aliased docker-compose command

The first is easy, but the second one I don't know how to do. For now I'll hardcode my project's path in bootlocal.sh, but I'll let you know if I make any progress!

@Maryom
Copy link

Maryom commented Aug 23, 2017

Hi,

Thanks for this gist. I need to use it but I got the following error:

chmod: /var/lib/boot2docker/bin/docker-compose: No such file or directory

screen shot 2017-08-23 at 10 59 06 am

I used docker for mac on macOS Sierra version 10.12.6

I tried to save install-docker-compose.sh in /var/lib/boot2docker/bin/ but there is no such path in macOS!

Could you please guide me where should I save install-docker-compose.sh ?

Any help ?

@jonatasfernandespimenta

Hi,

Thanks for this gist. I need to use it but I got the following error:

chmod: /var/lib/boot2docker/bin/docker-compose: No such file or directory

screen shot 2017-08-23 at 10 59 06 am

I used docker for mac on macOS Sierra version 10.12.6

I tried to save install-docker-compose.sh in /var/lib/boot2docker/bin/ but there is no such path in macOS!

Could you please guide me where should I save install-docker-compose.sh ?

Any help ?

I got the same error

@lmakarov
Copy link
Author

Sorry, I don't even remember why I created this script in the first place. It is 6 years old...

Boot2Docker is EOL since last year.
There is docker-compose v2 available now, which is part of the docker cli (docker compose ...):

@jonatasfernandespimenta

Sorry, I don't even remember why I created this script in the first place. It is 6 years old...

Boot2Docker is EOL since last year.
There is docker-compose v2 available now, which is part of the docker cli (docker compose ...):

oh, ok. thanks for the answer. I ended up installing the docker in the server since it is a linux remote server :D

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