docker-compose-installation

Docker docker-compose

docker-compose && fig

Installation

curl -L https://github.com/docker/compose/releases/download/1.1.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

or you can install docker-compose by PyPi(Python Package Index)

pip install docker-compose 

Install python pip

Note:
Python 2.5 was supported through v1.3.1, and Python 2.4 was supported through v1.1.
refer to :https://pip.pypa.io/en/stable/

Method 1:
## install pip by yum method under centos
yum install -y python-pip

Method 2:
wget --no-check-certificate https://github.com/pypa/pip/archive/1.5.5.tar.gz
tar zvxf 1.5.5.tar.gz 
cd pip-1.5.5
python setpu.py install

## at last , use pip to install software
pip install <software-name>

Usage

## get docker-compose help
docker-compose -h
## get certain command help
docker <command> -h
## start service 
docker run 
##
docker up

Example


公众号: DailyJobOps DailyJobOps

Docker 错误集合

no such file or directory

when build a Dockerfile ,and the file ‘redis.conf’ exists in real , but met such erro

Step 5 : RUN mkdir /usr/local/redis/
---> Running in 5cf73a52953f
---> 3351c41a56b4
Removing intermediate container 5cf73a52953f
Step 6 : COPY /home/dockerdir/Dockerfiles/redis.conf /usr/local/redis/conf/
**INFO[0007] home/dockerdir/Dockerfiles/redis.conf: no such file or directory** 

the reason:

  • if you build using STDIN (docker build - < somefile) , this is no build context ,so COPY can’t be used
  • COPY src dest ,here src just only filename without path ,so the file must exist in current build path ,and the dest must the folder with / or the certain filename

#INFO[0000] stat … not a directory
Step 5 : VOLUME /usr/local/redis/logs /usr/local/redis/var /usr/local/redis/conf
—> Using cache
—> a4ed3fb3bbfa
Step 6 : RUN chown -R redis:redis /usr/local/redis
—> Using cache
—> 338c50fe83bf
Step 7 : WORKDIR /usr/local/redis/conf/
—> Using cache
—> 00cbe70420b7
Step 8 : ADD redis.conf /usr/local/redis/conf
INFO[0000] stat /home/dockerdir/docker/devicemapper/mnt/58234d468c89c1e3877620fc6af37205e411ed86176de987e5336df6de8f9b27/rootfs/usr/local/redis/conf/redis.conf: not a directory

the reason

  • the reason is the same like above ,the ADD or COPY destination must be a folder with / or the certain filename

公众号: DailyJobOps DailyJobOps