Docker command lists for basic/common usage
- images: saved state of the container
- container: instance of a image
- dockerfile: file that describes all the steps needed to build a docker image
$ docker ps
$ docker ps -a
$ docker stop container
$ docker rm container
$ docker pull image-name
$ docker images
$ docker create --name container-name image-name
$ nvidia-docker create -i -t -v :/workspace --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -e DISPLAY=$DISPLAY --device=/dev/video0:/dev/video0 --privileged -v /tmp/.X11-unix:/tmp/.X11-unix:rw --name image-name:tag
- --name: container name
- -p: port mapping
- image-name: base image
- bash: optional command to run at instance time
$ docker run --name container-name -p 8888:8888 image-name bash
- -i: Keep STDIN open even if not attached
- -t: Allocate a pseudo-TTY
- -d: Detached mode: run command in the background
- -e: Set environment variables (ex.: DISPLAY=$DISPLAY)
-
-u: Username or UID (format: <name|uid>[:<group|gid>]) (ex.:
$(id -u):$ (id -g)) - -v: Bind mount a volume (ex.: ~/projects:/projects)
- --network: Connect a container to a network (ex.: host)
- --privileged: Give extended privileges to this container
$ docker start container
- -i: Keep STDIN open even if not attached
- -t: Allocate a pseudo-TTY
- -d: Detached mode: run command in the background
- -u root Run as root
$ docker exec -it container-name command
$ docker rmi image
$ docker images purge
$ docker images -f dangling=true
$ docker system prune
$ docker system prune -a
If the following error appear trying to open a app with ui interface
No protocol specified QXcbConnection: Could not connect to display :0 Aborted (core dumped)
execute this command outside docker:
$ xhost +local:docker