4, if there is only one path, for example docker run -it -v <path> <image>
, this situation is called anonymous mount, <image>
represents the location in the container, the host will randomly create a directory under/var/lib/docker/volumes/and container in the <path>
corresponding
5, in any way mount
, after the container is destroyed, the -v
directory created on the host will not be destroyed
6. In container, you can modify the properties of the file under the Mount directory, and it will take effect as viewed on the host. It should be noted, however, that if the owner of the file was modified in container, the owner of this file was not necessarily John when it was produced on the host. But the UID of the file is the same, as the name of the display is not the same, because the container and host's/etc/passwd file content is different
All of the above results can be docker inspect <container>
viewed in the results Mounts
.
Ii. entrypoint and CMD in the Dockerfile
Looks like it's all about implementing the container startup command, but note:
1, there are two ways, array mode, and Shell mode
["Sh", "-C", "echo Hello"]
Sh-c ' echo Hello '
2, EntryPoint In addition to the designated container entrance, the more important role is: through it can make a container like a executable. Like what
After the build of the mirror like a sh program file, run the image, just like running the SH program.
3, if the entrypoint specified, and the array method, that is ["exectable", "para1", "para2"]
, the CMD specified content will be treated as the last parameter in the entrypoint array
4, if the entrypoint uses the Shell method, then it will overwrite all CMD as well as the docker run
command specified later
5, docker run
the command specified later will replace the contents of CMD
Summarize
The above is for you to sum up some individuals in the use of Docker has fallen out of the pit, hope to share out so that everyone in the use of Docker can avoid these problems, the above is the entire content of this article, I hope to help you.