Docker container not saved

时间:2017-08-04 13:06:53

标签: tomcat docker

Just started with Docker and stuck with an issue. I'm running tomcat inside docker container. Docker image name = tomcat7.0.79 Started the container using the command: docker run -it --net=host tomcat7.0.79 /bin/bash

Installed vi editor using apt-get update && apt-get install vi Then updated users in tomcat-users.xml, exited the prompt and committed the docker container. Next time when I run the same container using the command docker run -it --net=host tomcat7.0.79 /bin/bash, the vi package is now missing. Why is it missing even after I committed the container? Can anyone please help?

1 个答案:

答案 0 :(得分:3)

docker run命令始终启动一个新容器。如果要重新运行已提交的更改,则必须运行您提交的新映像。

例如,

$ docker ps

CONTAINER ID        IMAGE               COMMAND             CREATED      STATUS              PORTS              NAMES
c3f279d17e0a        ubuntu:12.04        /bin/bash           7 days ago   Up 25 hours                            desperate_dubinsky

$ docker commit c3f279d17e0a  nishant/testimage:v1
f5283438590d

$ docker run -d nishant/testimage:v1