systemctl
command installed.
Rerun the image that you worked with in the prelab assignment and use the
docker exec
command to open a shell to the running container. To install
your favorite editor, first execute apt update
and apt upgrade
.
Then do an appropriate apt install
command. And while you're installing
things go ahead and install PHP as well.
Although the systemctl
command is not installed there is a command called
service
that works in a similar way. To check on the status of apache
We'll use it instead: service apache2 status
.
NOTE: Do not restart apache because it will cause the container to stop.
docker commit container-id yourid/tag
. In this case use a tag name
of: mylap
(i.e., my linux, apache, php).
You can see the images that exist on your local system with: docker image ls
.
You should now see the image you just created.
Now we want to transfer this image to your account at hub.docker.com. First you'll
need to tell docker your account credentials: docker login
. We'll ignore
the warning for now. Next you can push your saved image like this:
docker image push yourid/mylap
.
From a browser log in to your DockerHub account and verify that the image is now saved there.
We now actually the 3 layers of computing to be aware of:
We want to be able to connect to apache on the container from a browser on the local computer. Since the EC2 server and the container are both running apache on port 80 we'll need to connect a different port on the EC2 server to the container. Then we'll use port forwarding from our local computer to the modified port in EC2 to complete the chain. (Recall discussion of secure phpmyadmin for this last part).
Fiddle with this until you are able to see the default web page in your container from the browser on your local computer.
If the Dockerfile works you should be able to play an interesting guessing game in which you can formulate a question to eliminate some of the images. Once you've eliminated an image, click on it to turn it over.
yourid/mylap
available at DockerHub and
you should have Dockerfile which when built will produce a container that
provides a working guessing game application. To turn in your Dockerfile,
make a copy of it and give the copy a .txt
extension and then
upload into Canvas.