Top

Docker Container - Cheat sheet

by

Yves Sandfort

By
Yves Sandfort
and

As I started a set of cheat sheets before and the feedback was overwhelming I will continue to expand with some useful commands on docker container. Again I do not thrive to run this as a full blown tutorial, nor do I think this is a full command reference, this just summarizes commands I need again and again. And some of which I search again and again (wink)

Start the docker service on Photon OS

While docker comes preinstalled in Photon OS it still needs to be started and enabled before you can use it.

systemctl start docker
systemctl enable docker

Build docker container from Dockerfile

Move into the folder containing the Dockerfile and issue the following command:

dockerfile build . -t CONTAINERNAME:VERSION

Run docker container unless stopped / as a service

Sometimes we need to run docker container as a service and on a specific port.

docker run -dit -p 8080:8080 --restart unless-stopped CONTAINERNAME:VERSION

Questions?

Questions?

Ask

Yves

Thank you! Your message has been sent!
Oops! Something went wrong while submitting the form.