修改Docker镜像并重新打包 本次部署基础镜像采用codercom/code-server:4.14.1-bullseye
参考文档
https://blog.csdn.net/GliangJu/article/details/118080630
部署基础镜像 1 sudo docker run -it -d -p 9980:8080 -e PASSWORD='password' -u "$(id -u):$(id -g)" codercom/code-server:4.14.1-bullseye
安装一些软件和插件 软件 1 2 3 4 5 6 7 sudo apt install bash-completion sudo apt install wget sudo apt install linux-headers-$(uname -r) sudo apt-get install -y libicu-dev sudo apt install g++ sudo apt-get install build-essential sudo apt install openjdk-11-jdk-headless
插件 1 2 3 4 5 6 7 8 9 10 11 12 13 Code Runner Extension Pack for Java Markdown All in One Markdown All in One Dendron Paste Image Go Python Language PL/SQL Language Support for Java(TM) by Red Hat MySQL SQL Server (mssql) Oracle Developer Tools for VS Code (SQL and PLSQL) .NET Install Tool for Extension Authors
对修改过的镜像进行打包 重新打包修改后的镜像 1.将容器保存为镜像 1 sudo docker commit 3b64c2a1c5bf test/code-server:4.14.1-bullseye
2.将镜像打包 1 sudo docker save -o testcodeserver4.14.1bullseye.tar test/code-server:4.14.1-bullseye
3.将镜像包压缩 1 sudo tar -zcvf testcodeserver4.14.1bullseye.tar.gz testcodeserver4.14.1bullseye.tar
另一种打包压缩方法(发现这种方法压缩后体积更小) 1 docker save test/code-server:4.14.1-bullseye | gzip > testcodeserver4.14.1bullseye.tar.gz
将修改过的镜像解压以及镜像载入 1 2 3 4 5 6 7 8 9 # 压缩包解压,得到tar格式的镜像包 tar -zxvf testcodeserver4.14.1bullseye.tar.gz # 镜像载入 # 1. tar镜像载入 sudo dcoker load -i testcodeserver4.14.1bullseye.tar # 2. gz镜像载入 sudo docker load -i testcodeserver4.14.1bullseye.tar.gz # 查看镜像 sudo docker images