Your Dockerfile needs a valid image defined in the FROM command. By the looks of it, you are trying to run apt, which is typically from an ubuntu/debian linux. Try adding FROM ubuntu:latest to your Dockerfile.
As a side note, you wont need to split your apt-get install packages like that. You can do all at once like:
FROM ubuntu:latest
RUN apt-get update \
&& apt-get install -y \
nmap \
vim
It is recommended to split your commands & packages by line and sort them so it is easier to maintain.
In your example, is this not creating an Ubuntu container? If it is, this seems like a wasted container as it would just be a fresh Ubuntu install with my desired packages. It would seem to be better to just install my packages on an already existing container, e.g., nginx image.
Also, I though nginx, would a valid image since it’s what I am calling. Or does this mean, a valid image that is capable of making the commands? For instance, in this example, “RUN nginx start” would be acceptable.
If I run the container in your example, will all other containers be able to use those installed packages as well or do I have to “link” them in order to be used?
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:
FROM nginx
RUN apt-get update \
&& apt-get install -y \
nmap \
vim
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.