Please enable JavaScript.
Coggle requires JavaScript to display documents.
Docker (Abd-e-Ali), Lecture 3, Lecture 4, Lecture 5, Docker Certification
…
Docker (Abd-e-Ali)
Docker components
Docker client or Docker cli
- they may be many to access Docker server.
Docker server or Docker server daemon
- Docker server may be on the same machine on which Docker client is installed (in most organizations).
- it may on separate machine, where developers can access it. where no Docker client(s) is installed.
Basic Commands:
- To show running containers = docker container ps
- To show stopped containers = docker container ps -a
- service docker stop
- service docker start
- service docker status
- docker --version
- docker version (show client and server version with details)
- docker images ls
Questions:
- How to know Docker socket is running or not?
-
Docker Installation:
search 'docker installation on CentOS' and follow official resources of docker website
Lecture 3
Covered in Lecture 2
- Docker Installation
- Docker commands
- Docker benefits
HOW: we can upload DockerFile on Docker registry by making it Docker image.
- In IT industry, in production, all Linux flavour are avoid to us due to heavy weight (min: 2 - 10 GB)
So, Master OS is used where all can access.
- What we mention in DockerFile?
- OS name - mandatory
- App config: 2nd line
- Package install
- Image port listen (optional)
- Environment variable
- base images for Docker containers
- Alpine: webserver, python, Java, MySQL, Nagios, Prometheus
- BusyBox image: used to print any statement and message
Why not used CentOS - heavy weight 8-9GB, so use alpineWhat we will do with Docker images?? Ans: we will run it.
Questions:
- Is Docker run command able to pull the image? Ans: Yes (find locally then Docker registry)
- How to list Docker images in local??? Ans: 'docker images ls' command
- Steps to create Docker images? (in theory steps)
Ans:
- Create a Dockerfile
- Build the Image
- Run Containers (Optional)
- Push to a Registry (Optional)
- Distribute and Use
- not create through DockerFile, pull/download images from Docker Registry
-> Download command: Docker run hello-world
Cover in Lecture 1
- What 3 problems Docker has solved
- Docker images are read-only. can be edited but not execute.
- container is process run from images. A package of software (application, libraries, dependencies, package installation.)
- Architecture - server, client, registry
Create account on hub.docker.com (Docker repository/Docker hub)
Download/Pull Docker image from Docker Hub
Docker commands for practice
Rename Docker image:
docker run --name new-name old-name
remove container
docker rm container-id/name
remove automatically after execution
docker run --rm --name new_name2 first-name
Download/pull Docker images
docker pull download-link
Lecture 4
- docker run busybox echo 'hello from QAMAR' (show with input)
- docker run busybox (without any output)
- docker images = docker image ls (show locally available images)
- delete local image docker rmi repository_name/IMAGE ID
- delete container = docker rm container ID (1st remove container then able to delete image)
Question: files created in a Docker container can become visible on the host operating system? Ans: Not directly.We can't edit image but in container due to editable layer is added
- Docker image is read-only not writeable.
To see parameters in docker terminal
To start previous running container
- docker start container_ID (start without printing message)
docker exec = it take shell of container to go inside the terminaldocker exec -it CONTAINER9 /bin/sh (to go into already running container shell - go to the container but doesn't die the process)docker stop container_ID
- run and create new container and open shell
docker run -it --name mynew busybox /bin/sh
Previous Lecture summary
- How Docker file work in back-end
- what are requirements/needs for Docker file
- why alpine and BusyBox is used
- How 'docker run busybox' search in background Ans: locally if not, from internet docker Hib
- BusyBox is a OS.
Go into container? Yes, it has OS.
- docker run --it --name con_new_name old_name /bon/sh (it = interactive terminal, to go inside the shell/ container)
Lecture 5
-
-
-
covered in Lecture 4
- How we work with Alpine and BusyBox images.
in last lecure, we work busybox. but both are same.
- can download Docker image from DockerHub and internet.
Dockerfile --build--> Docker Image --run--> Docker ContainerDockerfile = create > execute > exit (if you print a message)
create > execute > and keep running (if you open a shell in the container)how to kill already running container = docker kill container_IDto remove a image from system, firstly you have to remove 'stopped container' (docker ps -a) by following command: docker rm container_ID, then you'll able to remove docker image.
- Remove Docker Container 2. then remove Docker Image
-