Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

[os-vagrant] What's the suggested way to install docker-compose? #128

Closed
tobowers opened this issue Apr 2, 2015 · 18 comments
Closed

[os-vagrant] What's the suggested way to install docker-compose? #128

tobowers opened this issue Apr 2, 2015 · 18 comments

Comments

@tobowers
Copy link

tobowers commented Apr 2, 2015

Hello!

Rancher os looks great. I'd like to give it a quick try for our infrastructure which uses docker-compose. What's the "right way" to install something like docker-compose in rancher? Installing it to /usr/bin feels wrong in rancher. However, having docker-compose in a container also feels a little weird too.

@ibuildthecloud
Copy link
Contributor

Just copy the docker compose binary to /opt/bin and and that to your path. /opt is persisted in the same fashion as /home. All other directories are ephemeral and will be deleted on reboot.

@deniseschannon
Copy link

@tobowers let us know if you are still having any issues and please re-open.

@pwFoo
Copy link

pwFoo commented Jan 26, 2016

But /opt/bin isn't in the set to path variable. Would be great to have a persistent /usr/local/bin...

@michaellopez
Copy link

@ibuildthecloud What is the recommended way to append to PATH in RancherOS?

@zot24
Copy link

zot24 commented May 6, 2016

I'm interesting on that as well as @michaellopez have you find a way to do it?

@michaellopez
Copy link

@zot24 Yeah, just follow @ibuildthecloud's advice.

I enabled ubuntu-console in RancherOS, then I downloaded the binary to /opt/bin/docker-compose via curl from the instructions in the release notes. After that I added:

export PATH=/opt/bin:$PATH

to ~/.bashrc

After reboot it should be found in the PATH and available globally on your system.

@michaellopez
Copy link

I'm not sure its the recommended way to use ubuntu-console and .bashrc to append to PATH, but I couldn't find any other way to do it. I would've liked to use something with cloud config or more "global" rather than a sourced file for the user account.

@zot24
Copy link

zot24 commented May 6, 2016

Thanks you so much @michaellopez I'll give it a try 👍

@zot24
Copy link

zot24 commented May 9, 2016

Just for the record @michaellopez for me I had to put it into /opt/rancher/bin/ and use ~/.bashrc_profile instead to make the trick works, thanks!

@michaellopez
Copy link

@zot24 Yeah, sorry. I tend to make all my .bash_profile always source .bashrc only. So I don't differentiate between remote session or local, always getting the same env.

.bash_profile:

if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

I did place my binary in /opt/bin though. We're on ros 0.4.3. But I'm glad you fixed your issue!

@zot24
Copy link

zot24 commented May 11, 2016

Thanks @michaellopez great staff appreciate the explanation! 👍 :)

@mmacfadden
Copy link

This method doesn't seem to work on RancherOS 0.5. here is what I did:

uname -a
Linux ip-172-31-38-141.us-west-2.compute.internal 4.4.10-rancher #1 SMP Fri Jun 17 17:16:24 UTC 2016 x86_64 GNU/Linux

wget https://github.com/docker/compose/releases/download/1.8.0-rc1/docker-compose-Linux-x86_64
chmod +x docker-compose-Linux-x86_64

./docker-compose-Linux-x86_64 version
-bash: ./docker-compose-Linux-x86_64: No such file or directory

This procedure worked on 0.45. I am wondering if there is some shared lib or something that is missing. Anybody else seeing this?

@mikesir87
Copy link

@mmacfadden - I'm seeing it as well.

@mmacfadden
Copy link

FYI, switching to the fedora console solved the problem. FYI, I switched to the fedora console on the exact instance that was having the problem, and I ran the same executable, that was still in the home directory. I suspect that there is a missing shared library or something in the default console.

@joshwget
Copy link
Contributor

joshwget commented Jul 6, 2016

We removed glibc in v0.5.0, so this is very like a side effect of that. Switching to any one of the alternate consoles should fix this issue. If you're using Docker Compose with RancherOS the alternate consoles will probably give you a better experience anyways.

@mmacfadden
Copy link

Yeah, that is what I found. Eventually we will use compose from outside of RancherOS (or some other thing completely) and use RahncerOS as a docker host, as intended. For now we need the ability to use compose internally, and switching to the fedora console worked just fine.

@joshwget FYI switching to the centos console failed and complained about missing images on docker.io.

berezins pushed a commit to berezins/os that referenced this issue Nov 20, 2016
Use host pid namespace for rancher agent
@mudrii
Copy link

mudrii commented Oct 8, 2017

you can run compose in rancheros as container
Add some additional goodies if you shell geek

docker run --rm docker/compose:1.16.1 version

~ $ cat .profile 
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi
~ $ cat .inputrc 
#.inputrc
"\e[A": history-search-backward
"\e[B": history-search-forward
"\e[C": forward-char
"\e[D": backward-char
"\C-x\C-r": re-read-init-file
set match-hidden-files off
set page-completions off
set completion-query-items 350
set completion-ignore-case on
set show-all-if-ambiguous on
set bell-style none
TAB: menu-complete
 ~ $ cat .bashrc 
# .bashrc
 
if [[ ${EUID} == 0 ]] ; then
PS1='\[\e[01;31m\]\h\[\e[01;34m\] \W \$\[\e[00m\] '
else
PS1='\[\e[01;32m\]\u@\h\[\e[01;34m\] \w \$\[\e[00m\] '
fi

export INPUTRC=~/.inputrc

alias docker-compose='docker run --rm \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v "$PWD:/rootfs/$PWD" \
    -w="/rootfs/$PWD" \
    docker/compose:1.16.1'

@rcourtman
Copy link

rcourtman commented Oct 22, 2017

mudrii - Thanks for that - I really like your approach. Question - I wanted to call 'docker-compose up -d' in a script... but it doesn't recognise the command. Any idea how I can get round that? It works from the command line just fine, it's just the script is obviously calling it differently and I'm not advanced enough to know why.

Thanks

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

No branches or pull requests