Docker

From John Freier
Revision as of 14:46, 6 September 2019 by Jfreier (Talk | contribs)

Jump to: navigation, search

This is a page all about Docker and helpful commands.

Docker File

ARG These are arguments that can be used in side the docker file.

 ARG BASE_DIR=/opt/app
 ...
 COPY ./file.txt $BASE_DIR

Port To expose port to docker to be exposed, lol kind of redundant.

  EXPOSE 4000

Docker Images

List This will show a list of all docker images.

 docker images

Remove This will remove an image from the list.

 docker rmi {imagename}:{tag}

You might need to force it.

 docker rmi -f {imagename}:{tag}

Run This is how you run an image

 docker run -it {imagename}:{tag}

To open the ports. Make sure you do this and have the ports exposed in your Dockerfile.

 docker run -p 8080:8080 -it {imagename}:{tag}

To run the image in a detacted container for it run in the background.

 docker run -d -it {imagename}:{tag}

To run an image and go right into bash for the starting point.

 docker run -it --entrypoint "/bin/bash" {imagename}:{tag}

To get into bash for a container.

 docker exec -it <container id> /bin/bash