24

So I have successfully downloaded and got running the dockerfile/nginx image from the registry. How can I now access its file system by firing up a bash terminal on it?

Maybe I am missing something conceptually here. Do I need to ssh into it? thanks

Zuriar
  • 11,096
  • 20
  • 57
  • 92
  • 2
    Possible duplicate of http://stackoverflow.com/questions/20813486/docker-exploring-containers-file-system – thSoft Dec 31 '14 at 13:13

1 Answers1

31

You can start an interactive shell in a new image:

sudo docker run -i -t nginx /bin/bash

This gives you access to the container and you can change things. When done you need to save your changes in a new reusable image:

sudo docker commit <container_id> <some_name>

This approach makes sense for testing. Usually you would use Dockerfiles to automate this.

In case your image has a default entry point you can overwrite it:

docker run -i -t --entrypoint /bin/bash nginx
Sebastian
  • 16,813
  • 4
  • 49
  • 56