Cheatsheet

Check Version

Containers

Lifecycle

Starting and Stopping

​

CPU Constraints You can limit CPU, either using a percentage of all CPUs, or by using specific cores.For example, you can tell the cpu-sharesarrow-up-right setting.

The setting is a bit strange -- 1024 means 100% of the CPU, so if you want the container to take 50% of all CPU cores, you should specify 512:docker run -it -c 512 agileek/cpuset-test

You can also only use some CPU cores using cpuset-cpusarrow-up-right:docker run -it --cpuset-cpus=0,4,6 agileek/cpuset-test

Note that Docker can still see all of the CPUs inside the container -- it just isn't using all of them.

Memory Constraints: You can also set memory constraintsarrow-up-right on Docker:docker run -it -m 300M ubuntu:14.04 /bin/bash

Info

Import / Export

Import/Export container

Import a container as an image from file:cat my_container.tar.gz | docker import - my_image:my_tagExport an existing container:docker export my_container | gzip > my_container.tar.gz

Executing Commands

Images

Lifecycle

Info

Load/Save image

Load an image from file:

Save an existing image:

Dockerfile

Instructions

Registry & Repository

Volumes

Lifecycle

Info

Networks

Lifecycle

Info

Connection

​https://github.com/wsargent/docker-cheat-sheet#dockerfilearrow-up-right

Last updated