- Open vcenter.kuisc.com
- Login
- Click on VMs and Templates
- Open Lawrence -> Security Club -> yourname-dockerlab
- Right Click on yourname-dockerlab
- Hover over Power
- Click on Power On
- Click on the Square that shows the current screen of the VM. Should be black with little white lines.
- Once the VM is spun on click on the user Docker
- Enter the password
workshop
- You should see the desktop screen
- If you don't please let me know
- On the left hand side of the sceen you should see a black rectangle with a >_. Click that.
- Once the terminal is open maximize it so you can see more of it.
- Type
docker --version
- You should see
Docker version 18.06.1-ce, build e68fc7a
- You should see
- Type
cd ~ && mkdir webserver && cd webserver
- Type
touch Dockerfile
- Type
sudo nano Dockerfile
- Inside this new document we will write the following. I'll explain what each line does as we go.
FROM ubuntu
RUN apt-get update
RUN apt-get install -y apache2
RUN apt-get install -y apache2-utils
RUN apt-get install -y nano
RUN apt-get clean
RUN mv /var/www/html/index.html /var/www/html/index.old
EXPOSE 80
CMD ["apache2ctl", "-D", "FOREGROUND"]
- To exit type ctrl+x, y, then enter.
- Type
sudo docker build -t="webserver" .
- After that completes type
docker image ls
- This shows all the images running.
- Now that the image is built we can create a container for it.
- In the terminal run
sudo docker run -d -p 80:80 --name web webserver
- Type
docker ps
- This shows all the containers currently running.
- Type
docker exec -it web /bin/bash
- Type
nano /var/www/html/index.html
- In that file type
<h1>Hello World</h1>
- Ctrl+x, y, enter
- After that, open Firefox and go to 0.0.0.0:80 to see your hello world page.
- Type
exit
in the terminal to exit the bash shell on the Docker container. - Type
sudo docker stop web && sudo docker rm web
- Type
sudo docker rmi -f webserver
- Type
sudo docker rmi -f ubuntu