
Docker, the DevOps Deity
-
Container: A process renting a space in memory. Built off of features of the Linux kernel (cgroups and namespaces).
-
Docker Containers: Builds an image that is retrieved from a repository, based on a control file. Contains only the components necessary to run the image.
-
Hypervisor VM: A traditional virtual machine, exists outside of a guest operating system to intercept the commands sent to the computer hardware.
-
Linux Containers (LXC): Virtualization of a full fledged operating system within linux kernels.
-
Restful API: Allows the developer or user to modularize the components of a transaction or a process.
-
Daemon: The long-term running background process that intermediates between Docker client and Docker registry.
-
Registry: Stores built Docker images to be served to build Docker containers.
-
Docker Hub: The default public registry.
-
Images: Web templates that hold instructions for the Docker daemon on what specifications and dependencies to build the container on.
Docker Installation
-
Docker Toolbox: Creates a small virtual machine instance via virtual box and runs Docker on it.
-
Repository: A location where you can find important files needed to run a program or script.
-
Hyper-V: A Windows feature that can virtualize operating systems and entire hardware components.
Run Docker Instead of Docker Running You
-
Docker CLI: The mode of communication between the user and the Docker service.
-
Docker Commands:
-
docker -v/version - shows the version of Docker installed.
-
docker login/logout - login/logout to your repository.
-
docker ps - for listing Docker containers.
- ‘-a’ - List all the containers, even the stopped ones.
- ‘-f’ or ‘–filter’ - Extract the necessary containers only.
-
docker container run - creates a given container on the specified instructions and executes the container so it spawns a process.
-
docker container start - executes an existing container.
-
docker container create - creates a given container on the specified instructions for doesn’t execute it.
-
docker container stop - aborts a running container
-
docker container rm - removes an already stopped container from the Docker container list.
-
docker inspect [container ID/name] - returns information from the lower level than “docker ps/docker container ls”
-
docker stats [options] [container] - shows the docker statistics like resource usage and also can be used to get information about specific containers.
-
docker container run - pulls an image and executes the container created with it.
-
docker container attach [optional flags][container ID/name] - attaches a container that was created or started in interactive mode with pseudo-TTY allocated
-
docker container exec [optional flags][container ID/name][command to be executed] - executes a command from within a given container.
-
docker container cp [source path][destination path] - copies files back a forth between and container and the host machine.
-
docker container stop - gracefully terminates a container (uses both signals SIGTERM & SIGKILL).
-
docker [container/volume/network/image/system] - removes dangling container/data/image/volume
-
docker rmi - removes images
-
docker rmi --rm - runs a container with the condition that the container will be removed if the container stops
-
docker clean up script - stops all containers and removes all Docker components like containers, networks, volumes, dangling images except the downloaded images
-
docker reset script - just as above but removes the downloaded images too.
-
Docker Universe
- Dockerfile - Holds instructions on how to build an image
- docker build [path] -t [tag name] - Used to build Docker image
- Github - Website that hosts public and private repositories.
- Git - tracks changes to source code.
Docker Networks
- Virtual Ethernet Devices (VED) - Allows containers to communicate with each other.
- Bridge - Aggregates multiple networks, the default network used by docker.
- Host - Container that is directly connected to the host machine so no port mapping required
- None - A completely isolated container that contains its own contained network stack
- Overlay - A network that runs atop of a network, uses a network to create one of its own.
- MACVLAN - A networking mode that enables assigning a MAC address to a container making it appear as a physical device on the network.
- docker network - command to manage docker networks.
- Docker port mapping - To map ports on the host machine to open ports on the container for external communication.
- docker port - shows the port mapping of a given container.
Docker Volumes
- Docker Volume - Managed by Docker and use the host system, created in the /var/lib/docker/volumes directory.
- Bind Mounts - Managed by host, can reference a non-existing piece of data, file or directory.
- Tmpfs Munts - Non-persistent storage on both the host and container, mounted on the RAM of the host.
- Docker container run -v or – mount - command to mount media to Docker containers.
Docker Compose
- Docker Compose - A tool for running and manage multiple containers, gives the ability to start or stop multiple containers with commands as if you were managing a single service.
- docker-compose up - brings up Docker Compose.
- docker-compose down - brings down Docker Compose.
- docker-compose - shows running containers by default.
- docker-compose restart - restarts Docker Compose.
- docker-compose top - shows usage statistics of Docker Compose.
- Portainer - Dock your Containers Visually
- Portainer - A web UI manager for Docker, can manage containers, networks, volumes and images.
- User space - Part of memory handling user executed code/programs
- Kernel space - Handles OS and background processes
- Type 1 hypervisor - Runs on hardware
- Type 2 hypervisor - Runs on OS which runs on hardware
- Network Transmission modes - Simplex, Half-Duplex, Full-Duplex.
Happy Hacking! 👽
Curso de Docker