By accessing the website and accepting the Cookie Policy, you agree to use the cookies provided by the Site in accordance with to analyze traffic, remember your preferences, and optimize your experience.
Docker容器内重启其他容器或者重启本身
2022-04-11 21:29:06    235    0    0
emengweb

Docker容器内重启其他容器或者重启本身> 其实道理一看就明白很简单,只需要将命令和docker运行后的文件映射进容器内就可以实现, 具体看命令

启动一个Nginx容器,将Docker映射进去

docker run --name nginx -v /etc/localtime:/etc/localtime:ro -v /var/run/docker.sock:/var/run/docker.sock  -v /usr/bin/docker:/usr/bin/docker -d nginx

启动容器后我们进入容器就可以相当于在容器内操作容器

进入容器
$ docker exec -it nginx /bin/bash
$ root@nginx:/# docker ps
CONTAINER ID   IMAGE                 COMMAND                  CREATED          STATUS          PORTS                                                                                                                             NAMES
f3d73c45399e   nginx                 "/docker-entrypoint.…"   35 seconds ago   Up 32 seconds   80/tcp                                                                                                                            nginx


上一篇: Oracle/甲骨文机器DD Ubuntu系统失败解决方法

下一篇: 搭建echoip,显示外网IP、地理位置信息

235 人读过
文档导航