将现有的系统打包成Docker镜像⽂件
将现有的系统打包成docker容器,⽤于构建镜像⽂件
将现有的系统打包成Docker镜像⽂件docker打包镜像
tar --numeric-owner --exclude=/proc --exclude=/sys --exclude=dev --exclude=run --exclude=boot -cvf /home/JosonDisk/centos7-base.tar /
tar --numeric-owner --exclude=/*.rpm \
--exclude=/home/JosonDisk \
--exclude=/usr/share/javadoc \
--exclude=/usr/lib/jvm \
--exclude=/usr/share/dotnet \
--exclude=/root/mySQL5.7 \
--exclude=/srv/pentaho-server-ce \
--exclude=/proc \
--exclude=/sys \
--exclude=dev \
--exclude=run \
--exclude=boot -cvf /home/JosonDisk/centos7-base.tar /
docker import centos7-base.tar centos7
docker run -itd --name JosonCentos centos7:latest /bin/bash
如果你的系统装有Docker 打包后,想使⽤Docker 那么上⾯语句会报错
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
⾸先 docker --version 看 docker 是否被打包进来了,然后使⽤ systemctl status docker 查看具体原因为:
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
那么你需要使⽤下⾯语句
docker run -itd --privileged=true --name JosonCentos centos7:latest /usr/sbin/init
docker tag centos7 josonjiang/centos7
docker push josonjiang/centos7:latest
docker pull josonjiang/centos7:latest
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论