Open wtsang11 opened 3 years ago
Ref: https://docs.docker.com/engine/reference/builder/
There are 3 forms of CMD in Dockerfile: The CMD instruction has three forms:
The main purpose of a CMD is to provide defaults for an executing container. These defaults can include an executable, or they can omit the executable, in which case you must specify an ENTRYPOINT instruction as well.
If CMD is used to provide default arguments for the ENTRYPOINT instruction, both the CMD and ENTRYPOINT instructions should be specified with the JSON array format.
docker image inspect
docker image rm
docker login docker image tag web1 wtsang/web1:latest docker image push wtsang/web1:latest -- wtsang = username, web1 = repo name docker pull wtsang/web1:latest
docker container run -it --rm --name web1 -p 5000:5000 -e FLASK_APP=app.py -d web1 -- see its log docker container logs web1 -- running another container on the same image -- note that the published port is given but the assigned port is dynamic -- note a different container name is given docker container run -it --rm --name web1 -p 5000 -e FLASK_APP=app.py -d web1_2 -- run a third container using restart flag such that remove flag cannot be used docker container run -it --restart --name web1 -p 5000 -e FLASK_APP=app.py -d web1_3 -- see the statistics docker container stats -- with debugging -- code changes eg in app.py will be hot reloaded docker container run -it -p 5000 -e FLASK_APP=app.py -e FLASK_DEBUG=1 --rm --name web1 -v $PWD:/app web1
http://localhost/TechNotes/wp-admin/post.php?post=1409&action=edit
VSC: http://localhost/lab/python/utilities/study_codes/opencodes.php?f=/Users/wtsang/Lab/docker/hands_on_with_docker/