d
WE ARE EXPERTS IN TECHNOLOGY

Let’s Work Together

n

StatusNeo

Docker – From Scratch To App (DevOps) – Part-1

Introduction

  • Docker is a platform where we can develop our application as a separate environment.
  • We can run, deploy and manage our application inside a docker.
  • We can create our application irrespective of the infrastructure of our system so that is a big advantage of using docker.
  • Having our application independent of the infrastructure helps in the faster development of the software.
  • Docker helps in faster delivery as no time is wasted around managing the correct versions of the packages.
  • Testing is also done in docker.
  • Overall we can conclude that docker act as a separate machine common to everyone that increases productivity and helps more in focusing on the code.
  • Docker is written in Go Programming Language (the backend of Docker).

Installation

Hello World! in Docker

  • Let’s get our hands dirty with docker.
  • After installation, let’s check whether it is installed correctly or not.
  • So for that let’s run the following command on our terminal.
docker --version
  • Currently, I am using 20.10.7, so we can see that docker is installed successfully for me.
  • This is how the UI of the Docker desktop looks like.
  • Now we have everything set up, so let’s first understand certain things about docker.
  • Container – A container is a lightweight isolated environment where we can package and run our application.
  • Many Container can be run simultaneously.
  • Most of the times applications are deployed as a container.
  • Image – Docker Images are the read-only instructions that are used for creating a container.
  • One Image can inherit another image, likewise, multilevel hierarchy is supported.
  • Hello-World image is already present in docker, so to access it, let’s run the below code.
docker run hello-world
  • Here we can see that the image was not present on our local system, so it downloaded/pulled the image for us and has shown the Hello from Docker !, message.
  • We are now done with the Hello World! , let’s move to some more stuff.

Common Commands used in Docker

  • To see the images on your local system –
docker images
  • In the output, we can see all the images are present in our local system.
  • Docker images command work same as –
docker image -ls
  • Both of them present the same output.
  • Whenever we run an image we are creating a container, so the docker run command creates a container.
  • We can run the images/containers with a different name also, for that –
docker run --name DemoName hello-world
  • Here we can see that the container ran successfully.
  • To see all the images that you have run-
docker ps -a
  • Here we can the name of the image, container id container name as well as status and their creation time with ports.
  • Similarly to see the last ran container, we can use-
docker ps -a -l
  • To delete a docker image-
docker rmi -f imageName
  • Here we can see in the output that we have successfully deleted hello-world image.
  • We can use docker rm to delete a stopped container.
  • To see all the currently running containers
docker container ls
  • To stop a container we can use-
docker stop containerId
  • To forcefully stop a container we can use docker kill instead of docker stop.
docker kill containerId
  • To login into someone’s organization hub or docker page
docker login

Conclusion –

  • That’s it from the first part.
  • In the next part, we will learn how to create an image and what are the different tags that are used with an image.

References-

Still Curious? Visit my website to know more!

For more interesting Blogs Visit- Utkarsh Shukla Author

Other Blogs Links-

  1. AWS LAMBDA COLD START – https://statusneo.com/aws-lambda-cold-start/
  2. AWS ElastiCache with Redis Part-1 – https://statusneo.com/aws-elasticache-with-redis-part-1/
  3. AWS ElastiCache with Redis Part – 2 (Flask application) – https://statusneo.com/aws-elasticache-with-redis-part-2/
  4. Google DialogFlow Part – 1 – https://statusneo.com/google-dialogflow/
  5. MQTT – IoT Messaging Protocol – https://statusneo.com/mqtt-messaging-protocol/
  6. ElasticSearch – Using Python – https://statusneo.com/elasticsearch-using-python/
  7. Python Program to return vowels in a string using Decorators – https://statusneo.com/author/utkarsh-shukla/
  8. AWS – AppSync Introduction and Demo – https://statusneo.com/aws-appsync-introduction-and-demo/
  9. Python: N-Dimensional List to a 1-Dimension – https://statusneo.com/python-multidimensional-list-to-a-single-dimension/
  10. GraphQL Using Python – Graphene Part-1 – https://statusneo.com/graphql-using-python-graphene-part-1/
  11. Node-RED – https://statusneo.com/node-red/
  12. DECORATORS IN PYTHON – https://statusneo.com/decorators-in-python/
  13. OpenWhisk – https://statusneo.com/openwhisk/

I am a versatile professional who specializes in empowering businesses with digital solutions. With expertise in software engineering consulting, I provide valuable guidance and support to companies seeking to enhance their technological capabilities. Additionally, I excel as a host(Professionals Unplugged), author, poet, and photographer. This diverse skill set allows me to creatively express my thoughts and ideas through various mediums. As a host, I engage audiences and facilitate insightful conversations. As an author, my writings offer valuable insights and knowledge. As a poet, I capture emotions and experiences through the power of words. And as a photographer, I have a keen eye for capturing captivating visuals. Overall, my wide range of skills and experiences make me a valuable asset in the world of digital solutions and creative expression

Add Comment