- So the next assignment was about containers.
Start a container based
on the docker.io/library/nginx:latest image,
and ensure that it meets the following requirements.
So the container is started by the root user.
The container main application
can be reached on localhost port 8080.
An environment variable is set as type=webserver.
The container is started as a background process.
And within the container,
a directory /data is presented
and all files written to the directory are mapped
to the directory /root/data.
So that sounds like a lot, but really it's just one command.
Let's check it out.
So I'm in a root shell already.
That's good.
So I can use podman, podman run, with a lot of options.
So we need to make sure that the main application
can be reached on localhost port 8080.
So it's -p 8080:80, that's the port forwarding.
Then we need to set an environment variable,
- - env type=webserver,
it needs to be a background process, that's -d,
and we need -v for the byte mount, /root/data:/data.
And as this is a centralize system
with podman and which is using asset Linux,
don't forget the uppercase Z.
And also, let's not forget the name of the image,
docker.io/library/nginx:latest.
My advice, if in the exam you get a question
where they are so specific
about the fully qualified image name
then use the fully qualified image name,
you might be evaluated
and they might check if you have really done that.
Now, there's one little thing,
and this little thing is
that we need to map to the directory data
in the route home directory,
so I'm using control A to bring my cursor to the beginning
and I'm using "mkdir data" to create this directory
in the route home directory.
So, podman ps is showing
that the nginx container is actually running.
So that's all.