Tuesday, August 4, 2015

Docker FAQ

Docker FAQ

Work in progress...


Load a docker image from a tar file:
docker load < TARGET_FILENAME.tar
See Save to find how to make something to load

Remove (delete) ALL existing containers:
docker rm $(docker ps -aq)

Runing from docker shows something like this:
strace: test_ptrace_setoptions_for_all: PTRACE_TRACEME doesn't work: Permission denied

strace: test_ptrace_setoptions_for_all: unexpected exit status 1
Perhaps docker needs to be run with the option --privileged

Save a docker image to a tar file (instead of putting in an archive):
docker save IMAGE_NAME > TARGET_FILENAME.tar
See Load for what to do with a save

Start a bash shell inside a running docker container:
Find the name of the container:
docker ps
or depending how your system is setup:
sudo docker ps
Then with the name (replacing 'crazy_name' in the examples) start interactive bash like this:
docker exec -it crazy_name bash
or:
sudo docker exec -it crazy_name bash

Terms

container (think of this as a running exe)

  • Running instance of an image.
  • It can be actively running and shows up via:
  • docker ps
  • It can be sort of sleeping and shows up when _all_ docker containers are shown via:
  • docker ps -a
  • Can be made of a an image via:
  • docker commit
image (think of this like an exe file on disk)
  • Stored set of stuff that must be run to become a container.
  • Can be seen via
  • docker images
  • A container can be made into an image via:
  • docker commit



No comments:

Post a Comment