How do I enter this dockerfile / nginx container?
UPDATE (a much easier method that was introduced later):
docker exec -t -i container_name /bin/bash
Original answer
Actually you can access a running container too.
Find your container's ID:
docker ps
Export the ID of the process that runs the container:
PID=$(docker inspect --format '{{.State.Pid}}' my_container_id)
"Connect" to it by changing namespaces:
nsenter --target $PID --mount --uts --ipc --net --pid
Originally this was described here: http://jpetazzo.github.io/2014/03/23/lxc-attach-nsinit-nsenter-docker-0-9/
First make sure to understand the difference between images and containers. Running the image:
docker run -d -p 80:80 dockerfile/nginx
creates a new container executing only nginx. This process does not interact like a shell. If you really need access to the files in this container while its running, your only option is to use nsinit, nsenter or lxc-attach. Have a look at https://blog.codecentric.de/en/2014/07/enter-docker-container/ for details.
Alternatively, you might want to try
docker run -it -p 80:80 dockerfile/nginx /bin/bash
which creates a new container executing an interactive shell instead of nginx.