zno2

docker run 需求

1. 当重启电脑时,容器自动启动

--restart always

PolicyResult
no Do not automatically restart the container when it exits. This is the default.
on-failure[:max-retries] Restart only if the container exits with a non-zero exit status. Optionally, limit the number of restart retries the Docker daemon attempts.
always Always restart the container regardless of the exit status. When you specify always, the Docker daemon will try to restart the container indefinitely. The container will also always start on daemon startup, regardless of the current state of the container.
unless-stopped Always restart the container regardless of the exit status, but do not start it on daemon startup if the container has been put to a stopped state before.

 

2. 通过指定的端口访问容器

Dockerfile 中通过 expose 暴露端口

运行时通过 -p 映射host的端口

 

3. 容器运行时,内部修改了数据,保存成新的image

commit

posted on 2023-06-01 17:10  zno2  阅读(6)  评论(0编辑  收藏  举报

导航