官方容器使用方法
拉取镜像
这个操作是使用容器的常规操作了,官方也都发布到了docker hub里面,直接拉取即可
<span class="token punctuation">[</span>root@lab101 /<span class="token punctuation">]</span><span class="token comment"># docker pull opencloudos/opencloudos:8.6</span>
<span class="token punctuation">[</span>root@lab101 /<span class="token punctuation">]</span><span class="token comment"># docker image ls</span>
docker.io/opencloudos/opencloudos <span class="token number">8.6</span> 85381566b97e <span class="token number">7</span> days ago <span class="token number">280</span> MB
启动容器
<span class="token punctuation">[</span>root@lab101 /<span class="token punctuation">]</span><span class="token comment"># docker run --name opencloudos --net=host --hostname=opencloudos -dit --privileged=true opencloudos/opencloudos:8.6 /sbin/init</span>
bbe06493e7b2305b430c635c23b06b6eeca7d0df38ebfa6a9ab8428a39f1b11c
进入容器
<span class="token punctuation">[</span>root@lab101 /<span class="token punctuation">]</span><span class="token comment"># docker exec -it opencloudos /bin/bash</span>
bash-4.4<span class="token comment">#</span>
可以看到进入容器是显示的bash-4.4不是主机名
可以看到
bash-4.4<span class="token comment"># ls /root/</span>
root下面是空的
应该是要有下面的
<span class="token punctuation">[</span>root@centos8 /<span class="token punctuation">]</span><span class="token comment"># ls /root/.</span>
./ <span class="token punctuation">..</span>/ .bash_history .bash_logout .bash_profile .bashrc .cshrc .tcshrc
检查常用包
bash-4.4<span class="token comment"># rpm -qa|grep hostname</span>
bash-4.4<span class="token comment"># rpm -qa|grep vi</span>
device-mapper-1.02.181-3.oc8.x86_64
device-mapper-libs-1.02.181-3.oc8.x86_64
发现vi和hostname命令都没加进去,这里基本的包还是保持比较好,这个在centos8的官方容器里面都做了保留
安装自己的环境
#根据自己的需要执行安装即可
yum install tar make libsodium-devel libmcrypt libmcrypt-devel mysql vim crontabs rsync git crontabs logrotate
yum install php-devel php-bcmath php-gd php-pdo_mysql php-mysqli php-posix
通过docker容器制作镜像
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
329349f3e1f7 opencloudos/opencloudos:8.6 "/sbin/init" 26 hours ago Exited (137) 2 hours ago opencloudos
docker commit -a '作者信息' -m '备注信息' 329349f3e1f7 platform/myopencloudos:v1.0
文章评论