It would seem to be better to just install my packages on an already existing container, e.g., nginx image.
If you wanted to add to the nginx image the proper way would be to build a new image
FROM the nginx image like this:
RUN apt-get update \
&& apt-get install -y \
This would give you a new image with nginx and whatever else you want. if you just want to add static content then that is an easy way to do it. Just add
COPY commands to your
Dockerfile to add your content.
If, however, you are building a dynamic web application, I would not install anything into the nginx image except a config file that forwards requests to your application running in another container. You can use
docker-compose to specify the dependencies and bring both containers up and down together.