//version is greater than 3.8
uname -a
//关闭SELinux
setenforce 0
//查看
getenforce
systemctl stop firewalld
free -m
yum install epel-release -y
yum list docker --show-duplicates
yum install -y yam-utils
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum list docker-ce --show-duplicates
yum install docker-ce
systemctl enable docker
systemctl start docker
vi /etc/docker/daemon.json
{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"],
"insecure-registries": ["harbor.test.com","registry.cn-shenzhen.aliyuncs.com"],
"bip": "172.7.5.0/24",
"exec-opts": ["native.cgroupdriver=systemd"],
"live-restore":true
}
docker run hello-world
docker login docker.io
cat /root/.docker/config.json
echo "xx=="|base64 -d
docker search alpine
docker tag imageId-xxx docker.io/zink/alpine:v3.10.3
docker push docker.io io/zink/alpine:v3.10.3
docker rmi -f imageId-xxx
[comment]: ( 交互,关联标准输入输出,后台运行,退出即删除,容器唯一名称)
docker run -i -t -d -rm -name
docker run -it --name alpine-zink alpin:latest /bin/sh
docker ps -a|grep -i exit|awk '{print $1}'|xargs docker rm -f
docker save c83a80ddb3a1 > alpine:tag.tar
docker load < xxxtag.tar
docker logs -f xxxx
docker run -p 81:80
docker run -v 挂载目录
docker run -e key:value
yum/apt-get/apt
docker pull nginx:1.12.2
wget http://www.baidu.com -O index.html
docker run --rm --name mynginx_baidu -d -p82:80 -v/home/zink/html:/usr/share/nginx/html zink/nginx:v1.12.2
docker exec -it mynginx_baidu /bin/bash
设置环境变量 -e
docker run --rm -e E_OPTS=abcd -e E_OPTS2=abcd2 alpine printenv
exec -it mynginx /bin/bash
tee /etc/apt/sources.list << EOF
deb http://mirrors.163.com/debian/ jessie main non-free contrib
deb http://mirrors.163.com/debian/ jessie-updates main non-free contrib
EOF
apt-get update
apt-get install curl -y
docker commit -p mynginx zink/nignx:withcurl
USER/WORKDIR
ADD/EXPOSE
RUN/ENV
CMD/ENTRYPOINT
vi Dockerfile
FROM nginx:1.12.2
USER nginx
WORKDIR /usr/share/nginx/html
docker build . -t docker.io/cyzink/nginx:v1.12.2_with_workdir
docker run --rm -it --name nginx_workdir cyzink/nginx:v1.12.2_with_workdir /bin/bash
FROM ngix:v1.12.2
ADD index.html /usr/share/nginx/html/index.html
EXPOSE 80
docker run --rm -it --name nginx_html -P cyzink/nginx:v.1.12.2_with_html /bin/bash