profile

Hi, I’m a creator

5 Docker Commands for you to get started!

Published 11 months ago • 1 min read

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 <tag_name> <path_to_dockerfile>

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 <tag_name>

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 <container_name> <command_to_run>

Docker Stop

Stops a running docker container.

docker stop <container_name>

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 <image_name>

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 <image_name>


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, I’m a creator

Read more from Hi, I’m a creator

Hello there, Hope you are doing good. Token based Authentication is one of the most popular and widely used authentication and identity management systems used across the world. It is simple, easy to integrate and makes user experience better. Applications can decouple User Identity and Authentication layer to an externalized Authorization Server layer and delegate authentication to this server. You will only enter credentials at a centralized Identity Provider site and the application...

10 months ago • 2 min read

Hello there, Hope you are doing good. I wanted to share some interesting news to you. You want to add authentication to secure your resources, authorize access, implement CORS policies, enforce HTTPS, or even cache responses – you will add the respective built-in libraries to the web application. These are all exposed by the ASP.NET Core framework as Middleware – pieces of code blocks that are responsible for a single functionality. Announcing my new digital product - "How to work with...

10 months ago • 1 min read

Hello there, Hope you are doing good. This week, I want to introduce you to the 3 caching patterns that we generally use to implement Caching in our applications. We choose a caching pattern that best fits our application based on its behavior, business requirements and tolerance. The following are the 3 popular patterns used for caching in microservices. Cache-Aside The cache is lazy loaded with data only when needed and is not available in the cache. The microservice decides if the data...

11 months ago • 1 min read
Share this post