5 Docker Commands for you to get started!


Hello there,

Hope you are doing good.

This week I want to introduce you to Docker and 5 commands you must know to started.


What is Docker?

Docker is a Container Runtime. It helps you build and run Containers based on the custom Image you build.

When you use Docker as a Runtime to build and run your Containers, those containers are called Docker Containers.

You can build, run and manage containers in Docker via Docker Commands.

Here are the top 5 commands you must know to get started

  • docker build
  • docker run / stop
  • docker ps
  • docker exec
  • docker pull / push

Docker Build

builds a Docker image from a Dockerfile.

It reads the instructions in the Dockerfile and creates an image based on those instructions.

The resulting image can be used to run container instances.

docker build -t

Docker Run

creates and runs a container from a Docker image.

It starts a new container instance based on the specified image, allowing the application within the container to run independently.

You specify the Host Port and Container Port mapping using the -p flag.

docker run -p host_port:container_port

Docker ps

Displays all the available containers that are currently running.

Adding -a flag shows all the stopped containers as well.

docker ps

Docker Exec

Executes a command within a running container.

The -it flag allows interactive access to the container, enabling input and output with the container’s command line.

docker exec -it

Docker Stop

Stops a running docker container.

docker stop

Docker Pull / Push

Docker pull Downloads Docker images from a registry.

It retrieves the specified image or the latest version if not specified, making it available locally for running containers without needing to build the image locally.

docker pull

Docker push uploads Docker images to a registry.

It pushes the specified image or tagged version to the designated registry, making it available for others to download and use.

docker push


I hope you found the content useful and informative.

Please do like on Facebook, we are nearing 2000 likes and your like means a lot. Please do follow on Twitter, I do regularly post my latest updates over there.

Have a great week.

Cheers

Ram

Hi there, I’m Ram

If you're starting in software engineering or an experienced professional, I post informative content around stuff I work with - Full Stack Development. Subscribe to my newsletter to receive my latest posts.

Read more from Hi there, I’m Ram

Hello there, Hope you are doing good. In this week's newsletter, I want to introduce you to the third principle of the SOLID principles: five principles describing few fundamental rules for developing arguably ideal software components which are scalable, extensible, robust and flexible - the Liskov Substitution Principle. This principle can be termed as one of the basic foundations of the Object Oriented Design languages which talks mainly about substitutions and inheritance. The principle...

Hello there, Hope you are doing good. In this week's newsletter I want to introduce you to one of the most efficient internal sorting algorithm, and discuss how to implement it - Quicksort algorithm step by step with an example and analyze time complexity. Quick Sort is an internal sorting technique which can be used to arrange a given set of unordered dataset into required order. It is the most efficient internal sorting technique, which doesn’t use any auxiliary memory (or additional space...

Hello there, Hope you are doing good. In this week's newsletter, I want to introduce you to the fourth principle of the SOLID principles - Interface Segregation. In the early stages of application development, it’s common to place all logic into a single class. As the application grows, these classes become bloated or “fat” with unrelated responsibilities. Later, when we try to extract interfaces from these classes for modularity or extension, we may end up with interfaces containing many...