0
0
Dockerdevops~5 mins

What is Docker - CLI Guide

Choose your learning style9 modes available
Introduction
Docker helps you package your app and everything it needs into a small container. This container runs the same way on any computer, so you avoid problems caused by different setups.
When you want to share your app with others and be sure it works the same on their computers.
When you need to run multiple apps on one server without them interfering with each other.
When you want to test your app in a clean environment that matches production.
When you want to deploy your app quickly and easily to cloud servers.
When you want to keep your development environment consistent across your team.
Commands
Check if Docker is installed and see its version.
Terminal
docker --version
Expected OutputExpected
Docker version 24.0.2, build cb74dfc
Run a simple test container to verify Docker is working correctly on your machine.
Terminal
docker run hello-world
Expected OutputExpected
Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world Digest: sha256:7e4a7f3a5a3a4e5a3a4e5a3a4e5a3a4e5a3a4e5a3a4e5a3a4e5a3a4e5a3a4e5a3 Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly.
Key Concept

If you remember nothing else from Docker, remember: it packages your app and its environment into a container that runs the same everywhere.

Common Mistakes
Trying to run Docker commands without Docker installed or running.
The commands will fail because the Docker engine is not available to process them.
Install Docker and start the Docker service before running commands.
Expecting Docker containers to behave exactly like virtual machines.
Docker containers share the host OS kernel and are lighter, so some VM features are not available.
Understand Docker containers are lightweight and designed for app isolation, not full OS virtualization.
Summary
Docker packages your app and its environment into a container.
Containers run the same way on any computer with Docker installed.
Use 'docker run hello-world' to test your Docker setup.