Website: https://www.docker.com/
Documents: https://docs.docker.com/
- Carves up a computer into a sealed containers that run your code.
- Gets the code to and from your computer
- It builds a containers for you
- It is social platform to find and share containers, which are different from virtual machines.
Hyper -V Container for creating linux containers
- It is self contained sealed unit of software
- Contains everyting required to run the code.
- Includes batteries and OS
- It includes: a) Codes b) Configs c) Processes d) Networking e) Dependencies
- A client program
- A server program that manages a linux system.
- A program that builds container from code.
- A service that distributes containers
- A company that makes containers
-
Command :
docker run hello-world
--Command to Check whether docker is working fineOutput : Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 1b930d010525: Pull complete Digest: sha256:9572f7cdcee8591948c2963463447a53466950b3fc15a247fcad1917ca215a2f Status: Downloaded newer image for hello-world:latest
Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/
-
Command:
docker info
--The above command gives the server side info about the docker
-
Images
Command:
docker images/docker image ls
Output: REPOSITORY:hello-world
TAG:latest IMAGE ID:fce289e99eb9 CREATED:13 months ago SIZE:1.84kB
-
Running Container-->
Command to run the container: docker run -ti <REPOSITORY_NAME>:<TAG>
eg: docker run -ti hello-world:latest bash
/ti -- terminal Interactive
Command to list the Container: docker container ls
/ docker ps
- Stopped Container-->
Command for a stopped Conatainer: docker ps -l --format=$FORMAT
Output: CONTAINER ID :d90360cc6dd4
IMAGE: hello-world
COMMAND: "/hello"
CREATED: 2 hours ago
STATUS: Exited (0) 2 hours ago
PORTS:
NAMES: great_wescoff
- Commiting Container-->
Commiting and creating a new image:
docker commit e758f9fd8b12 -- e758f9fd8b12/Container id
--OUTPUT:sha256:a16eeff5f29036c1c6e320258105087946e9e0716edb27afc5d5c521e59208e1docker tag sha256:a16eeff5f29036c1c6e320258105087946e9e0716edb27afc5d5c521e59208e1 my-image
-- Renaming the image
Another Way of commiting an image:
docker commit 9b2d94a18f04 my-immage2
docker-images
- Containers have a main purpose
- The containers stop when the process stops
- Conatainers have names