Day 16: Docker
Docker
Docker is a platform that allows you to build, test and deploy applications quickly. Docker packages software into standardized units called containers that have everything that needs to run including libraries, system tools, code and runtime.
- Use the docker run command to start a new container and interact with it through the command line.
docker run command is used to create a new container.
command docker run -d <container-name ID> in detached mode.
sudo docker run -d nginx:alpine
To run the container with the port number
sudo docker run -d -p 8080:80 nginx:alpine
To run the container with the name
sudo docker run --name ngix-container nginx:alpine
To check all containers
sudo docker ps
To inspect the container
sudo docker inspect <container-name>
To check the port of the container
sudo docker port <container-name>
To check the stats of the docker
sudo docker stats
To check the process in the container
sudo docker top <container-name>
To save the docker container
sudo docker save nginx:alpine --output nginx-backup.tar
To load the image from the tar file
sudo docker load --input ngix-backup.tar