Docker - adamclark2/Photos GitHub Wiki

How to Use/Setup Docker

Basic instructions relevant to the project. See extras for extra commands such as deleting a container.

Install

Use the gui installer for windows or Mac

https://docs.docker.com/docker-for-windows/install/
https://docs.docker.com/docker-for-mac/install/#install-and-run-docker-for-mac.

DockerWindowsInstaller

Docker build

build an image from a dockerfile. You may optionally do docker pull to pull the from image. If this is your first time building the image prepare to go for a coffee break ☕️ , this can take a while the 1st time however docker will be faster with subsequent builds.

-t [name] tags the image with a name in this case img docker build .

Docker run

Create a new container and run it from an image

docker run --name imgc -p 8080:8080 -ti img
--name [name] name the container
-p 8080:8080 map port 8080 in the container to port 8080 on the host machine
-ti terminal interactive mode (get a shell into the container basically)
[image name] the name of the image to create the new container from
docker run after a build

It's alive!

It Works

Extras -------------------------------------------------

Docker images

list all the images Docker Images

Docker pull

pull an image from the internet. I.E. Download ubuntu ahead of time. docker pull ubuntu

Docker ps and Docker rm

View all containers and remove a container. Docker ps -a AND docker rm

Security

The files tomcat-users.xml and context.xml aren't secure configurations. You can however access the tomcat ui from the host using user and pass1 ... 🔐

Basic Issues/Troubleshooting

Issue Basic Solution
I can use docker run Did you try docker rm [container name]
The container doesn't have the latest code Rebuild docker image and re-run docker build -t [image name] ./
The container isn't working Try terminal interactive mode, use -ti in docker run
The container isn't working Did you forward the port? -p 8080:8080 in docker run