Docker

Containers: Docker
Docker use cases
Docker creation
Docker operation
Docker Compose
Docker Swarm
Docker installation
Docker Machine
  • Docker Machine Overview
    Docker Machine is a tool that lets you install Docker Engine on virtual hosts, and manage the hosts with docker-machine commands. You can use Machine to create Docker hosts on your local Mac or Windows box, on your company network, in your data center, or on cloud providers like Azure, AWS, or Digital Ocean.
    Machine was the only way to run Docker on Mac or Windows previous to Docker v1.12. Starting with the beta program and Docker v1.12, Docker Desktop for Mac and Docker Desktop for Windows are available as native apps and the better choice for this use case on newer desktops and laptops. We encourage you to try out these new apps. The installers for Docker Desktop for Mac and Docker Desktop for Windows include Docker Machine, along with Docker Compose.
  • Docker Desktop for Windows uses Microsoft Hyper-V for virtualization, and Hyper-V is not compatible with Oracle VirtualBox. Therefore, you cannot run the two solutions simultaneously. But you can still use docker-machine to create more local VMs by using the Microsoft Hyper-V driver.The prerequisites are:
Docker: image customization
Modification of a service configuration file in a container
  • Copy the configuration files in the container to the host:
    # Syntax: docker CP < container name / container ID >: < path of configuration file in container > < path to be copied to host > $ docker cp mysql:/etc/mysql/mysql.conf.d/mysqld.cnf ~/mysqld.cnfModify the configuration file in the host. Then copy the modified  configuration file back into the container:# Syntax: docker CP < path of configuration file in host > < container name / container ID >: < path of configuration file in container > $ docker cp ~/mysqld.cnf mysql:/etc/mysql/mysql.conf.d/mysqld.cnfRestart the container.
Docker performance
Docker and time
Docker migration
Docker and media streaming
gst-launch-1.0 \
v4l2src device=/dev/video0 \
! videorate ! videoscale \
! clockoverlay shaded-background=true font-desc="Sans 38" \
! video/x-raw,format=I420,width=640,height=360,framerate=25/1 \
! jpegenc ! rtpjpegpay \
! udpsink host=localhost port=5000
  • And here is the client:
gst-launch-1.0 -v \
udpsrc port=5000 \
! application/x-rtp, encoding-name=JPEG, framerate=25/1 \
! rtpjpegdepay ! jpegdec ! videoconvert ! ximagesink
  • Solution: I just needed to install gstreamer1.0-x as well.

Docker in Windows
  • Get started with Docker Machine and a local VM
  • Boot2Docker is a lightweight Linux distribution made specifically to run Docker containers. It runs completely from RAM, is a ~45MB download and boots quickly.
    Boot2Docker is officially deprecated and unmaintained. It is recommended that users transition from Boot2Docker over to Docker Desktop instead (especially with the new WSL2 backend, which supports Windows 10 Home).
Docker in Windows WSL2

Docker container and ARM architectures

When building docker images on an M1, you’ll need to enable an experimental feature and then can build images for both amd64 (x86) and arm64 (M1)

# The usual way on intel
docker build ---push -t mbari/polynote:latest .# On Apple Silicon
docker buildx build --platform linux/amd64,linux/arm64 --push -t mbari/polynote:latest .

Useful Docker containers