docker网络端口映射,没有方便点的操作方法么?
PHP中文网
PHP中文网 2017-04-25 09:04:19
0
3
655

在容器里安装新软件后,必须commit后,再run来添加端口么,这要麻烦死了啊:(

PHP中文网
PHP中文网

认证0级讲师

reply all(3)
伊谢尔伦

If it is still troublesome to use -p to map the port when running, you can write it in the Dockerfile

巴扎黑

You can write the run command as a shell file, and then execute this file directly. No need to write every time.

習慣沉默

Maybe your usage is not very correct

Generally speaking, a container should only run one service. In this case, it seems strange to install new software into a container and then commit it

You can create a base image, and everything else is built on this base image

Then, docker-compose and dockerfile essentially allow you to easily manage containers and images (multiple builds of the same dockerfile will be cached as images), so you can write more on your basic image dockerfile, each dockerfile only installs one service you need to use

The screenshot is my docker-compose.yml. When running, it is very clear that there is one service and one container

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template