CONTAINER ID IMAGE COMMAND
CREATED STATUS PORTS NAMES
dfe3a47945d2 nginx "nginx -g 'daemon of..." 21
seconds ago Up 20 seconds 0.0.0.0: test-nginx
80->80/tcp
You can also use docker container port test-nginx
to list just the port mapping.
If you open a web browser and point it to http://0.0.0.0,
your nginx server should show you a default HTML page
(see Figure 13-26).
Figure 13-26 nginx in a Docker Container
A web server with default content is not very useful.
Containers are meant to be read-only, but there are a
couple ways to add your own content. There is the cp
command, which allows you to copy files from your local
host to the container when it is up and running; however,
in order to save those changes, you would have to store
another layer on top of your container and then push
that new container to your repository. This would have to
be done every time a change is made. A better way is to
mount the content directly to the container when it boots
up so that it can share the content. This way, if you need
to update anything, you just change the files in one