Docker Keynotes

Devendra Parhate
2 min readSep 11, 2020

--

Deployment Architecture:

Docker container can be deployed on:

1. Container orchestration tool like Kubernetes, Docker Swarm, OpenShift, etc for production purpose

2. Docker Daemon for development purpose

Container Isolation Architecture

OS internal used for environment isolation:

Resources managed by OS facilities

Namespaces:

  1. Process
  2. Network
  3. IPC
  4. Mount
  5. User

CGroups:

  1. Resource limits

Security:

  1. SELinux

Container — Host communication Architecture

Terminology

Layer: a set of read-only files to provision the system

Container: Running instance containing required s/w Created from images

Image: a read-only layer that is the base of your container. Might have a parent image

Port: Can be visible and invisible to outer world

Volume: Shared folder

Registry / Hub: central place where images live

Docker hub: Registry with web UI

Docker machine: a VM to run Docker containers (Linux does this natively)

Docker compose: a utility to run multiple containers as a system

Commands:

docker run ubuntu /bin/echo ‘Hello world’

Docker cleanup commands

  1. Kill all running containers: docker kill $(docker ps -q)

2. Delete dangling images: docker rmi $(docker images -q -f dangling=true)

3. Remove all stopped containers: docker rm $(docker ps -a -q)

4. Create and start containers: docker-compose up

Interacting with a container

  1. Run a command in the container: docker exec -ti container_name command.sh

2. Follow the container logs: docker logs -ft container_name

3. Save a running container as an image: docker commit -m “commit message” -a “author” container_name username/image_name:tag

Docker machine commands

Use docker-machine to run the containers

  1. Start a machine: docker-machine start machine_name

2. Configure docker to use a specific machine: eval “$(docker-machine env machine_name)”

Useful one-liners

  1. Download an image: docker pull image_name

2. Start and stop the container: docker [start|stop] container_name

3. Create and start container, run command: docker run -ti — name container_name image_name command

4. Create and start container, run command, destroy container: docker run — rm -ti image_name command

Example filesystem and port mappings

docker run -it — rm -p 8080:8080 -v /path/to/agent.jar:/agent.jar -e JAVA_OPTS=”-javaagent:/agent.jar” tomcat:8.0.29-jre8

--

--

Devendra Parhate
Devendra Parhate

Written by Devendra Parhate

Functional programmer who likes to process state with reactive distributed systems

No responses yet