I'm having trouble figuring out how to edit nginx.conf inside NGINX open source Docker container.

I'm trying to follow the directions here:


I've gotten through all 4 steps succcessfully. I have SSH access using the helper mynginx4_files container.

This part confuses me, though:

  • the /bin/bash argument means that the bash shell runs in the helper container, presenting a shell prompt that you can use to modify files as needed

This sounds good! Unfortunately, I don't see any way I can modify nginx.conf. There's no text editor that I can see. I don't see vi or emacs or anything else. (I searched through all 4 'bin' directories, and whereis and find didn't turn up anything for vi.) I tried to install vi using apt-get but was unsuccessful. I even tried ubuntu instead of debian, but even with ubuntu there is no text editor. I thought vi is standard on all Linux distributions. I don't know what's up, but I feel like I'm missing something big here. Any help greatly appreciated.

1 Answer 1


I suggest you mount your conf file as a volume:

docker run -v nginx.conf:/etc/nginx/nginx.conf ....

This way you can easily change the file outside the container and then just restart the container. If you change your config file inside the container and then you should have to restart nginx to pick-up the changes. At that point your container will stop because you stopped the main process.

Your local nginx.conf should already have the initial configuration which you can copy from inside the container (cat /etc/nginx/nginx.conf).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.