UBUNTU14 version above comes with Docker but version older sudo apt-get install-y docker.iosudo ln-s/usr/bin/docker/usr/local/bin/dockersudo sed-i ' $a Complet-f _docker Docker '/etc/bash_completion.d/docker ufw:vim/etc/default/ufw default_forward_policy = ' ACCEPT ' Sud o UFW Reload Docker command error fata[0000] shutting down daemon due to errors:pid file found, ensure Docker was not running or Del Ete/var/run/docker.pid and Sudo
sudo docker images#查看docker镜像
sudo docker pullImage name: Label #下载基础镜像 Busybos is a streamlined Unix toolset
sudo docker search-s 10 mirroring#搜索被收藏10次以上的镜像
Dockerfile Instances# # maintainer Carson,c.j.zeong <[email protected]># docker-version 1.6.2## dockerizing centos7:dockerfile for building CentOS images#from centos:centos7.1.1503& nbsp #基础镜像系统MAINTAINER Carson,c.j.zeong <[email protected]> # Maintenance Manager env TZ "Asia/shanghai" &NBSP ; #环境变量ENV term xterm add aliyun-mirror.repo/etc/yum.repos.d/centos-base.repo #ADD可以拷贝url下的文件, Decompression function add Aliyun-epel.repo/etc/yum.repos.d/epel.repo run yum install-y Curl wget tar bzip2 unzip vim-enhanced passwd sudo yum-utils hostname net-tools rsync mans && \ yum install-y gcc gcc-c++ git make automake cmake Patch logrotate python-devel libpng-devel libjpeg-devel && \ Yum install-y--enablerepo=epel Pwgen p Ython-pip && \ Yum Clean all # Run is a mirrored operation command, each run is a layer of run pip install Supervisoradd supervisord.conf/etc/supervisord.conf run mkdir-p/etc /SUPERVISOR.CONF.D && \ mkdir-p/var/log/supervisor expose 22 &NBSP ; #EXPOSE是这个容器的端口号, but for the client is invisible, a port on the host is mapped to the port number of the container. The client accesses the host's port entrypoint ["/usr/bin/supervisord", "-N", "-C", "/etc/supervisord.conf"] # Execute volume ["/opt/project" when container starts #持久化的 .dockerignore file Store ignore file name
sudo docker build-t mirror name: Tag(Can write version)
directory where Dockerfile is located
sudo docker run [parameter] Mirror name: Label
Parameters:
-it #iThe flag ensures that the stdin (standard input) in the container is on, and T is a TTY pseudo-terminal
- D#后台运行, return ID number-P Docker port number #宿主机会给自动分配端口号-P Docker host port number: Dokcer port number--name Docker runtime Name of the directory in host directory/docker #挂载-h=a #容器的主机名 sudo docker ps-a #查看docker所有进程 Sud o Docker commit ID number mirror name #在docker进程中创建镜像 sudo docker exec-it ID number or docker name/bin/bash #进入ps运行中容器的伪终端 sudo docker rm-f ID number or Docker name #删除正在运行dockersudoDocker
rm
$(sudo docker
ps
-a -q)
#删除所有的容器 sudo docker stop ID number or docker name #停容器 sudo docker start ID number or Docker name #启动容器 a single Docker host can be managed with fig
Docker Action Commands (personal note)