Get Started, Part 1: Orientation and setup
Get Started, Part 1: Orientation and setup
Docker concepts
Docker is a platform for developers and sysadmins to develop, deploy, and run applications with containers. The use of Linux containers to deploy applications is called containerization. Containers are not new, but their use for easily deploying applications is.
Containerization is increasingly popular because containers are:
- Even the most complex applications can be containerized.
- Lightweight: Containers leverage and share the host kernel.
- Interchangeable: You can deploy updates and upgrades on-the-fly.
- Portable: You can build locally, deploy to the cloud, and run anywhere.
- Scalable: You can increase and automatically distribute container replicas.
- Stackable: You can stack services vertically and on-the-fly.
Images and containers
An image is an executable package that includes everything needed to run an application–the code, a runtime, libraries, environment variables, and configuration files. (A container is launched by running an image. )
A container is a runtime instance of an image–what the image becomes in memory when executed (that is, an image with state, or a user process). You can see a list of your running containers with the command, docker ps
, just as you would in Linux.
Containers and virtual machines
Prepare your Docker environment
The details is on https://mirrors.tuna.tsinghua.edu.cn/help/docker-ce/
Test Docker version
- Run
sudo docker --version
to ensure your docker has been installed.
Docker version 18.09.0, build 4d60db4
- Run
sudo docker info
or (sudo docker version
without--
) to view even more details about your docker installation.
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 2
Server Version: 18.09.0
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
add your user to the docker group
(grants privileges equivalent to the root user)
- Create the
docker
group. - Add your user to the
docker
group - Verify you privileges
Test Docker installation
docker run hello-world
Recap and cheat sheet
## List Docker CLI commands
docker
docker container --help
## Display Docker version and info
docker --version
docker version
docker info
## Execute Docker image
docker run hello-world
## List Docker images
docker image ls
## List Docker containers (running, all, all in quiet mode)
docker container ls
docker container ls --all
docker container ls -aq