Intro to Docker - raisercostin/software-wiki GitHub Wiki

Summary

The Deployment Problem

The solution for Shipping Containers

The solution for Software Deployment

Docker is a software that combines tools, standards and conventions to be able to

  • contain software
  • use container in different environments: cloud, bare metal server, vms

The software is abstracted as:

  • executable
  • ports
  • storage
  • environment variables

Docker Usage Patterns

Import/Export Container

You can transfer a image via a file <myapp>-<version>.tar. After you import the container as a image you can start a new container with specific settings/ports via docker run using the <local/myapp>-<version> as the image tag.

docker export --output="<myapp>-<version>.tar" <container>
docker import <myapp>-<version>.tar <local/myapp>:<version>

Run from a temp image

See https://medium.com/the-code-review/docker-run-vs-exec-deep-dive-into-their-differences-19a1041735a3

docker run --name test2 --rm -it <image-id> sh

Run from a temp container

See https://medium.com/the-code-review/docker-run-vs-exec-deep-dive-into-their-differences-19a1041735a3

docker run --name test2 -it <image-id> sh
docker start test2
docker exec -it test2 sh

DoNot

  • install your registry: a heavy process for just one image export/import

Resources

How to cleanup

How to investigate a failed to start container

docker commit <myContainerId> myContainerSnapshot
docker run -it myContainerSnapshot /bin/bash

run as root

docker exec -it -u root <myContainerId> bash

Check content of an image

docker run -rm -it <image Id|Tag> /bin/sh

Resouces

⚠️ **GitHub.com Fallback** ⚠️