Reputation: 581
I am trying with aws rancher os. I want to create and run a docker-compose file with the same rancher OS. When I am trying with Docker-compose up command I am getting the error 'not recognized docker-compose.
please anyone help me on this
Upvotes: 3
Views: 10261
Reputation: 627
According to the RancherOS console documentation, the following directories are persistent:
/home
/opt
/var/lib/docker
/var/lib/rancher
With that in mind, we can upload the binary to our /home
directory and add it to our executable path.
--
To find the correct build, find the "machine hardware" architecture of your instance:
uname -m
# Example output: `x86_64`
Download the corresponding binary from the releases page and upload it to your server (using scp
, rsync
, etc..):
rsync --progress ./docker-compose-linux-x86_64 user@host:~/docker-compose-linux-x86_64
Login to your server and prepare the file:
# Create a `bin` directory to house our executables
mkdir ~/bin
# Move the file to the bin directory (renaming it in the process)
mv ~/docker-compose-linux-x86_64 ~/bin/docker-compose
# Make the file executable
chmod +x ~/bin/docker-compose
Assuming your shell is bash
(to confirm, run echo $SHELL
), create a .bash_profile
document with the following contents to add our new directory to our executable PATH
variable:
[ -d "${HOME}/bin" ] && export PATH="${PATH}:${HOME}/bin"
Upvotes: 0
Reputation: 301
Only to add another possibility to AXE Labs and Vincents suggestion:
create a file /usr/bin/docker-compose
with the following content:
#/bin/bash
docker run \
-ti --rm \
-v $(pwd):$(pwd) \
-v /var/run/docker.sock:/var/run/docker.sock \
-w $(pwd) \
docker/compose \
$@
and another chmod +x /usr/bin/docker-compose
now you can use commands like docker-compose up
as if it where installed!
Upvotes: 5
Reputation: 999
RancherOS is a minimal installation of the Linux kernel, Docker daemon, and generally as little as possible else. docker-compose
is not part of the default console.
Depending on what you're trying to do you can create a RancherOS service with docker-compose syntax: https://rancher.com/docs/os/v1.2/en/system-services/adding-system-services/
Or run actual docker-compose from a container: docker run docker/compose:1.10.0
Or switch to one of the persistent consoles and install it locally: https://rancher.com/docs/os/v1.2/en/configuration/switching-consoles/
Upvotes: 7
Reputation: 4541
Vincent's suggestion to use the compose container works, with some extra params:
$ cat > /tmp/docker-compose.yml << _EOF
> version: '3.0'
>
> services:
>
> busybox:
> image: busybox:latest
> command: "/bin/sh -c 'sleep 30s'"
>
> alpine:
> image: alpine:latest
> command: "/bin/sh -c 'sleep 60s'"
> _EOF
$ docker run -v /tmp:/tmp -v /var/run/docker.sock:/var/run/docker.sock -w /tmp docker/compose:1.14.0 up -d
Creating network "tmp_default" with the default driver
Creating tmp_busybox_1 ...
Creating tmp_alpine_1 ...
Creating tmp_busybox_1
Creating tmp_alpine_1 ... done
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7f0eccacd100 alpine:latest "/bin/sh -c 'sleep..." 2 seconds ago Up 2 seconds tmp_alpine_1
8f36a3cb1345 busybox:latest "/bin/sh -c 'sleep..." 2 seconds ago Up 2 seconds tmp_busybox_1
This was in RancherOS v1.0.1.
Upvotes: 2