Docker 镜像添加模块


Docker 镜像添加模块

 

1. 使用root用户进入一个新容器,不要用 --rm .否则退出容器的时候,容器没有了

apt install ...
npm install -g n 
pip3 install ...

3. commit 刚才操作的容器成 image (testdockerfilebox/test_cpu:v1 名称和版本号可以自己定义)

root@test:~# docker images 

REPOSITORY                         TAG                 IMAGE ID            CREATED             SIZE

testdockerfilebox/test_cpu           v1                  e4f2c829d1eb        23 minutes ago      4.42GB

5. 将新的 image 保存成 tar 压缩文件,给其他人使用,统一开发环境

docker load -i test_cpu.tar

此时使用 docker images 就可以看到刚才的导入的 image 了

root@test:~# docker images 

REPOSITORY                         TAG                 IMAGE ID            CREATED             SIZE

testdockerfilebox/test_cpu          v1                  e4f2c829d1eb        23 minutes ago      4.42GB

 

相关