DEV Community

Cover image for #007 Docker Images and Containers
Omar
Omar

Posted on

5 1

#007 Docker Images and Containers

Introduction

this is part 7 from the journey it's a long journey(360 day) so go please check previous parts , and if you need to walk in the journey with me please make sure to follow because I may post more than once in 1 Day but surely I will post daily at least one 😍.

And I will cover lot of tools as we move on.


Back to Hello World demo

in part 6 we run

docker run Hello-World
Enter fullscreen mode Exit fullscreen mode

docker-hello-world

As we see in 1 the docker client contacted the docker daemon as we discussed earlier

in step 2 the docker doesn't find the image hello-world locally so he go to the docker hub and downloaded for us!

see how easy it is with one command we got an image!

in step 3 the Docker create a new container using the image we downloaded and run it so we got this output

in step 4 the deamon (server) send back the message to us ! (client)


Docker Image and container

If you are a programmer and you study OOP(Object Oriented Programming) we can think about Image as an Class ,

and the container is an instance of it kind of

Car tesla = new Car();
Car toyota = new Car();
Enter fullscreen mode Exit fullscreen mode

We can imagine the Image as the Car and the Container as tesla and toyota , see I build on top of 1 Image 2 Containers and there is no need to pull image again from dockerhub so it will skip step 2!


let's run an light linux system (alpine)

docker run -it alpine sh
Enter fullscreen mode Exit fullscreen mode

-it stands for i is interactive and t is an pseudo-TTY (pseudo terminal to communicate with bash)

alpine is a light linux distro which contain basic files and kernel to run linux

sh is kind of a bash

demo-1

as we see , docker doesn't find the alpine locally , so he pull it from docker hub

demo-2

as we see home directory is empty (home directory is linux folder like D: in windows you can locate personal files not system files)

mkdir (make directory is a linux also windows command to make a directory) and test is folder name

as we see when I restart the docker , I lost the changes I made !

this will be covered later.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (0)

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay