Docker volumes 1 - beginner level
This exercise is part of the Docker inside out course.
Create a file called index.html in your working directory with the following content:
Start a container using the image „alpine" with an internal volume with the path „/usr/share/nginx/html" and give it the name „ storage".
Then create a container using the nginx image version 1.13.5-alpine and use the volume provided by the storage container. Call the nginx container „ nginx-alpine".
Make sure that the
nginx-alpine container uses the created index.html.
(Hint: browse the index.html page from the host command line)
Create the storage container with the following command:
Create the NGINX container with the desired name and image version:
Look up the IP address using a filter on the output of the created nginx-alpine container with the following command:
You will get an output like this (your IP address may be different according to your settings and number of running containers):
Reach the default index.html file from the nginx-alpine container:
You should see a „403 Forbidden" message (instead of the freshly made index.html) because the directory from the storage container is empty.
To use our index.html copy it into the storage container:
Look for the web page again and it should give back your index.html.
You could also copy your index.html into the storage container right after creating it, of course. We just wanted to demonstrate the change.
Go to the Docker inside out course