docker modify an existing image
-
First use the mirror to start container
docker run -d -p 8100:80 hello:v-1.0
-
Into the container
docker exec -it <name> bash
-
Edit the file to edit, first you need to install the editing software
apt-get update
Update software sourceapt-get install vim
Install vim -
Modify
app.py
filevim app.py
from flask import Flask
# 获取方式对象,(就随意)命名为app
app = Flask(__name__)
# 使用app绑定路由
@app.route('/')
def hello():
# 页面内容
# 添加新内容
html = '<h1>Hello Docker</h1><p>修改内容</p>'
return html
# 启动
if __name__ == '__main__':
app.run(host='0.0.0.0',port=80)
exit
Exit container;docker restart <name>
reboot containerAccess
ip:port
can be found page has been updated
Mirror upload and download
The image can be considered to share files online, allowing others to use
First, go hub.docker.com or cloud.docker.com register an account
Build a warehouse used to store images
Log in using the following command
docker login
You will be prompted to enter a user name and password input
After successful login will promptLogin Succeeded
Mirroring Push
Mirror Package
docker image tag [imageName] [username]/[repository]:[tag]
Example:docker image tag hello:v-1.0 chongjing/hello:v-1.0
Mirroring Push
docker image push [username]/[repository]:[tag]
Example:docker image push chongjing001/hello:v-1.0
Reproduced in: https: //www.jianshu.com/p/271e23eb3818