Skip to content
This repository has been archived by the owner on Jan 1, 2021. It is now read-only.

Pre-install docker-compose (useful on Windows) #603

Open
josephpage opened this issue Oct 28, 2014 · 19 comments
Open

Pre-install docker-compose (useful on Windows) #603

josephpage opened this issue Oct 28, 2014 · 19 comments
Labels
question Usability question, not directly related to an error with Boot2Docker

Comments

@josephpage
Copy link

Pre-install Fig is the only way I found to get a working Fig out of box with Boot2docker on Windows.
Fig is lighweight, very useful and now part of Docker, so... why not ?

I'm waiting for your comments.

@josephpage
Copy link
Author

Trying to add this to line 160 of Dockerfile :

# Get Fig
ENV FIG_VERSION 1.0.0
RUN curl -L https://github.com/docker/fig/releases/download/$FIG_VERSION/fig-Linux-x86_64 > $ROOTFS/usr/local/bin/fig && \
    chmod +x $ROOTFS/usr/local/bin/fig

results in :

docker@boot2docker:~$ fig
-sh: fig: not found
docker@boot2docker:~$ /usr/local/bin/fig --version
-sh: /usr/local/bin/fig: not found
docker@boot2docker:~$ ls -al /usr/local/bin/fig 
-rwxr-xr-x    1 root     root       5247064 Oct 28 15:59 /usr/local/bin/fig

😢 Any idea ?

@SvenDowideit
Copy link
Contributor

several :)

boot2docker is a 32 bit userspace running on a 64 bit kernel (seriously, its a long tale)

ie, you need the 32 bit version

@josephpage
Copy link
Author

Ok. So Docker is run in a 64 bits user space, how is possible to manage fig run the same way ?

@tianon
Copy link
Contributor

tianon commented Nov 4, 2014

Docker is compiled 100% statically, so it can run directly on the 64bit kernel and ignores the userspace entirely. Fig must not be, is my only guess here.

@josephpage
Copy link
Author

For my team's needs I made an script+alias that takes place in /var/lib/boot2docker/bootlocal.sh

Adding this alias in Boot2docker iso should be a great think for Windows users, and not visible to OS X users. Are you ok with my commit ?

@dduportal
Copy link
Contributor

Proposal of @josephpage and me for generating (quickly ?) a fig official docker image, while waiting for the "Docker groups" proposal implementation : docker/compose#619 (comment)

@mikehaertl
Copy link

Now that docker-compose is released, this issue should be updated to include that instead.

@dduportal
Copy link
Contributor

Just to let you know that this PR : #748 maybe a big help for the future : it will make boot2docker a full 64 Bits OS (user and kernel), leaving possibility to embed docker-compose

@ebuildy
Copy link

ebuildy commented Apr 20, 2015

+1, docker-compose is really missing

@VonC
Copy link

VonC commented Apr 20, 2015

@ebuildy but it does run just fine within a container, so it might not really be missing on Windows: see How to install docker-compose on Windows.

@edmorley
Copy link
Contributor

edmorley commented Jun 8, 2015

Whilst the native Compose binary doesn't work in the boot2docker VM due to docker/compose#599, installing the docker-compose Python package inside boot2docker works perfectly (from what I can tell so far).

In fact, it seems to work even better than the "docker-compose in a container" method (aka alias docker-compose="docker run -v ...") - since that currently has a caching bug (dduportal-dockerfiles/docker-compose#6).

As such for now, running the Python docker-compose package inside boot2docker seems to be the most reliable solution for Windows users (having spent many hours trying to battle with the alternatives).

To install docker-compose from PyPI, run this from inside boot2docker:

docker@boot2docker:~$ tce-load -wi python && curl https://bootstrap.pypa.io/get-pip.py | sudo python - && sudo pip install -U docker-compose

To save having to run the above every time the boot2docker VM is restarted (since changes don't persist), you can use bootlocal.sh like so:

docker@boot2docker:~$ echo 'su docker -c "tce-load -wi python" && curl https://bootstrap.pypa.io/get-pip.py | python - && pip install -U docker-compose' | sudo tee /var/lib/boot2docker/bootlocal.sh > /dev/null && sudo chmod +x /var/lib/boot2docker/bootlocal.sh

(The su docker -c gymnastics are required since tce-load cannot be run as root, and bootlocal.sh is run as root. The chmod of bootlocal.sh should be unnecessary once #915 is fixed. Add -a to the tee command if you need to append, rather than overwrite bootlocal.sh.)

If you wish to use a pre-release version of docker-compose, then replace pip install -U docker-compose with pip install -U docker-compose==1.3.0rc2 or equivalent.

@bhatt40
Copy link

bhatt40 commented Jun 8, 2015

@edmorley Thanks for this. I used this method to install docker-compose on the Boot2Docker VM, but I have one issue. When I ssh into the VM and run the docker-compose ps command, I receive this error:

Couldn't connect to Docker daemon at http+unix://var/run/docker.sock - is it running?

I know the daemon is running, because I can run docker ps from my Windows host and get a list of running containers. I notice that $DOCKER_HOST is undefined in my Boot2Docker VM, but I'm not sure what it should be set to within the VM.

@edmorley
Copy link
Contributor

edmorley commented Jun 8, 2015

DOCKER_HOST is undefined for me too inside the VM, but docker-compose ps still works. I'm using boot2docker 1.6.2, if that makes a difference. Sorry I don't know what else to suggest! :-)

@jayfresh
Copy link

jayfresh commented Jun 9, 2015

@edmorley Having done this inside the boot2docker vm (in Windows), I'm now unclear whether I can reference the files I had available on my main disk. What I'm trying to do is make use of docker-compose in a development workflow, so I'd like to mount a local folder into the container. Unfortunately, docker-compose isn't accessible from the boot2docker bash terminal, and the files aren't available to reference if you ssh into the vm. Of course, I might be misunderstanding how it's working...

@edmorley
Copy link
Contributor

I'm now unclear whether I can reference the files I had available on my main disk.

By default boot2docker shares anything under C:\Users\ as /c/Users/ in the VM. You're able to customise this (eg add your own src dirs outside of the users folder) - but it's a bit of a pain at the moment (see #678).

As such, if you're able to easily move your src into somewhere under the users folder, the workflow is then as simple as:

[~/src]$ boot2docker ssh
...
docker@boot2docker:~$ cd /c/Users/Ed/src/foo/
docker@boot2docker:/c/Users/Ed/src/foo$ docker-compose build
...
docker@boot2docker:/c/Users/Ed/src/foo$ docker-compose up
...

@dduportal
Copy link
Contributor

Hello !

You have to keep in mind that :

  • The docker-compose binary is a self-embeded python interpreter with the application and dependencies. Some are statically compiled, other are not => context dependent.
  • While the pip install option will take care of getting the dependency stack for you, on the contexte you are running.

On the boot2docker side :

  • boot2docker < 1.7.0 Old versions have a 32-bits userspace, that make the default docker-compose binary not running by default. The solution proposed by @edmorley to have it inside the VM is a working one, while it have to be written in /var/lib/boot2docker/bootlocal.sh in order to persist across reboots. (Idea of boot2docker as a "transparent hypervisor" explains why until today, there is no python/deps/pip/docker-compose embedded.
  • boot2docker >= 1.7.0 The future : have a 64-bits userspace (See Tcl6 64 bit userspace #854 which has been merged on master AFTER 1.6.2 release ). So docker-compose binary works out of the box. Maybe we can propose to install compose inside as a "docker official part" now that it isn't fig anymore ?

On Windows side using boot2docker as a remote Docker Engine :

  • You can use for now the container based solution, the behaviour of caching was corrected (TL;DR; vbox shared folder with sendfile is bad. Recent moving to linux alpine with shared folder use sendfile. Getting rid of alpine for now while waiting for docker 1.7.x to introduce new volume sharing system). See doesn't read yml file properly dduportal-dockerfiles/docker-compose#7 (comment)
  • Docker-compose can theoretically be built under Windows. Since i'm not a python guy, i'm not sure how to exactly do that, but getting a 64 bits python dev + pip inside Windows would be a great beginning ?

The sharing folder part may also be improved when playing in remote mode with Docker 1.7.0 : https://github.com/docker/docker/blob/v1.7.0-rc3/CHANGELOG.md#170-2015-06-16

Hope it helps

@dduportal
Copy link
Contributor

Just added a PR for that : #932

@wharsojo
Copy link

Hi Guys,

I did some packaging docker-compose + tmux + zsh (prezto - OMZ) into easy installation:
https://github.com/wharsojo/myboot2docker

you can see on this demo how installation and docker-compose works, including tmux, zsh (prezto - OMZ) alt text

hope it helps.

@jayfresh
Copy link

thanks guys!

@josephpage josephpage changed the title Pre-install Fig (useful on Windows) Pre-install docker-compose (useful on Windows) Aug 13, 2015
@wglambert wglambert added the question Usability question, not directly related to an error with Boot2Docker label Jul 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Usability question, not directly related to an error with Boot2Docker
Projects
None yet
Development

No branches or pull requests