Docker cheat sheet
You can limit CPU, either using a percentage of all CPUs, or by using specific cores.
docker run -it -c 512 agileek/cpuset-test
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.
docker run -it -m 300M ubuntu:14.04 /bin/bash
Import a container as an image from file:
cat my_container.tar.gz | docker import - my_image:my_tag
Export an existing container:
docker export my_container | gzip > my_container.tar.gz
Load an image from file:
docker load < my_image.tar.gz
Save an existing image:
docker save my_image:my_tag | gzip > my_image.tar.gz
- COPY copies new files or directories to container. By default this copies as root regardless of the USER/WORKDIR settings. Use
--chown=<user>:<group>to give ownership to another user/group. (Same for