Docker Recep!🤠🐳
I thought can I add more value in a single mail than 1 hr session. Let me know..
Introduction
After the LinkedIn session, I felt I should document all this so that upcoming interns in TechHut and eventually everyone. So this is the first article in this segment.
If you prefer a video tutorial check out the following,
Docker Quick Starter
Run a Redis container
> docker run -it --rm -p6379:6379 redis
-it : Interactive mode (logs are visible & you can interact with the terminal)
—rm : Removes the container once it is stopped.
-p6379:6379 : connects container port to host port (You can access container service from host system using open port)
List running container
> docker ps
A random name and containerId will be assigned. You can see other details like open ports, images, entry point command, etc.
See logs of this container
> docker logs -f ba7459bebad4
or
> docker logs -f unruffled_mirzakhani
You can use containerId or name to get the logs.
Connect the container and execute commands
> docker exec -it unruffled_mirzakhani bash
or
> docker exec -it ba7459bebad4 bash
You can use containerId or name to execute in the container.
We usually use sh or bash as a command to get shell access & then run the commands.
Stop a container
> docker container stop ba7459bebad4
or
> docker container stop unruffled_mirzakhani
Remove a container
> docker container rm ba7459bebad4
or
> docker container rm unruffled_mirzakhani
List images
> docker images
Thank you for reading. Stay tuned for the next articles.
Share your feedback and help us improve with you,
Know anyone who can get benefited from our articles, send some good vibes,