It might be desirable to to install docker-compose as a container. The official way is to use wrapper script. Here is an alternative approach using an alias
.
# alias docker-compose='touch ${PWD}/.env; \
docker run \
--privileged \
--rm \
--env-file ${PWD}/.env \
--volume ${PWD}:/tmp/$(basename ${PWD}) \
--volume /var/run/docker.sock:/var/run/docker.sock \
--workdir /tmp/$(basename ${PWD}) \
docker/compose:1.13.0'
On CentOS-7 or Centos Atomic Hosts the docker-latest
binary can be use to run Docker 1.13. If you have this configured and the alias is for a non-root user use the following example to call docker-latest
with sudo
.
NOTE: Populate a .env
file with any necessary environment variables.
$ alias docker-compose='touch ${PWD}/.env; \
sudo /usr/bin/docker-latest run \
--privileged \
--rm \
--env-file ${PWD}/.env \
--volume ${PWD}:/tmp/$(basename ${PWD}) \
--volume /var/run/docker.sock:/var/run/docker.sock \
--workdir /tmp/$(basename ${PWD}) \
docker/compose:1.13.0'