Docker Commands

Docker Commands

Docker Basic commands for beginners


So to get at the list of all the available docker commands you can just type


in your terminal (Linux or Unix) or your cmd or PowerShell for windows

docker version
docker -v
docker info

Building Docker Image

Ways to create a docker image

  1. Committing changes in the docker container
  2. dockerfile

Committing changes from a docker container

get a Debian image from docker hub

docker run -it debian:jessie

So you will need to install git within the container.

apt update
apt install -y git

The docker commit command syntax

docker commit original_docker_container_id repo_name:tag

Success, you can now run docker images to see you new image


Create the docker file. NB the docker file doesnt have an extension and should have a capital D 🙂

touch Dockerfile

Now edit the file

nano Dockerfile

Dockerfile arguments

More info here

Docker build command

docker build -t name_of_image:version directory_path_of_source

docker build -t ernestImage:1.00 .

Once done run the the image

docker run -d -p 5000:5000 78aaa5c6e606
  • -d = running in the background
  • -p = exposing the port
  • 1st port container port
  • 2nd port host port

Leave a Reply

Close Menu