Can I build nginx server on ubuntu container?

I’m a beginner for docker.
I hava some questions about docker.

  1. I want to build nginx webserver on ubuntu container.
    I want to listen to your advice:slight_smile:

  2. And I want to use my ubuntu container like normal ubuntu OS.
    However, I can’t use ‘sudo’ and ‘apt-get’ etc.
    How can I resolve this problems?

Use the standard image.

VirtualBox is a widely used virtualization solution that will give you exactly this, and if it’s important to you to be able to sudo or ssh into your runtime, that’s probably much closer to what you’re looking for.

It’s much more common to use Docker in a kind of batch mode, where you describe what goes into a container (in a Dockerfile, but using familiar commands like apt-get) and then run it non-interactively. This official Docker tutorial should hopefully give you a feel for it. Typical containers won’t have a working sudo, or any way to “log in” to the container from outside, and won’t be running heavy-weight init systems like systemd; usually they are running only a single process. (Run ps -ef on your host and look at everything that’s running; the nginx image I referenced above will be running only one process at all, nginx.)

I use apt-get all the time in containers…

sudo… you are typically running as the root user… unless you specify differently…

for example
docker run -it ubuntu

and u should get a commandline… then u can install modules like always

the ping command is not installed by default SO…
apt-get install ping
this works for me…

normally you do all that setup in the Dockerfile, so that once your container is running it has all the function you need.