选择适合你的docker版本
例子:版本:docker-23.0.1
https://download.docker.com/linux/static/stable/x86_64/docker-23.0.1.tgz
tar -zxvf docker-23.0.1.tgz
cp docker/* /usr/bin
vim /etc/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
ExecStart=/usr/bin/dockerd --selinux-enabled=false --insecure-registry=127.0.0.1
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
chmod +x /etc/systemd/system/docker.service
systemctl daemon-reload
systemctl start docker
systemctl enable docker
重启docker服务
systemctl restart docker
测试安装mysql
docker pull mysql/mysql-server:5.7
保存
docker save -o app10015.tar app10015:latest
docker save -o mysql5.7.tar mysql/mysql-server:5.7
加载镜像
docker load -i app10015.tar
docker load -i xxx.tar
运行
docker run -id
-p 10015:10015
–net=host
–name=app10015_sl
app10015:latest
FROM java:8
VOLUME /tmp
ADD Dxw-10015.jar app10015.jar
CMD java -jar app10015.jar
docker build -f ./cc -t app10015 .
yum update
#yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce
docker -v