Docker reported an error when mounting the configuration file when creating the nginx container. Some big brothers are eager to raise some points! Thank you, thank you! ! ! !

  docker, question

Docker and ngixn mirror information is as follows:

root@iZ28q62x60iZ:/srv/testServer# docker -v
 Docker version 18.03.1-ce, build 9ee9f40
 root@iZ28q62x60iZ:/srv/testServer# docker images
 REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
 nginx               latest              649dcb69b782        19 hours ago        109MB
 root@iZ28q62x60iZ:/srv/testServer#

Execution error reports the following error:

root@iZ28q62x60iZ:/srv/testServer# docekr run --name nginx -d -p 80:80 -v $PWD/conf/nginx.conf:/etc/nginx/nginx.conf nginx
 No command 'docekr' found, did you mean:
 Command 'docker' from package 'docker.io' (universe)
 docekr: command not found
 root@iZ28q62x60iZ:/srv/testServer# docker run --name nginx -d -p 80:80 -v $PWD/conf/nginx.conf:/etc/nginx/nginx.conf nginx
 4db2ddccc4022c305991a1dce568fd8332087d5543a56f4a573cde69de33feb8
 docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: contain  er init caused \"rootfs_linux.go:58: mounting \\\"/srv/testServer/conf/nginx.conf\\\" to rootfs \\\  "/var/lib/docker/overlay2/3d4b01b3ed517480faba01aa1edb6fbb9e2dc01d5de5239e8c8d00d3a159777a/merged\\\" at \\\  "/var/lib/docker/overlay2/3d4b01b3ed517480faba01aa1edb6fbb9e2dc01d5de5239e8c8d00d3a159777a/merged/etc/nginx/nginx.conf\\\" caused \\\"not a directory\  \\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)?  Check if the specified host path exists and is the expected type.
 root@iZ28q62x60iZ:/srv/testServer#

Docker misspelled the first command.

The error message of the second order is obvious:

$PWD/conf/nginx.conf is directory, while /etc/nginx/nginx.conf in mirror is regular file, volume mount failed.

How to solve the rest should not prompt, should delete, should build

It is recommended that you carefully look at the directory structure of the configuration files in the nginx image, such as /etc/nginx/conf.d/. If you only add server block, you do not need to modify the default settings.