列出所有 container
docker ps -a
啟動即停止 container
docker start container_id/name
docker stop container_id/name
刪除 container
docker rm container_id/name
在目前路徑執行 container 指令 (通常用於編譯)
docker --workdir $PWD container_id/name command
--------------------------------------------------------------------------------
docker --helpUsage: docker [OPTIONS] COMMANDA self-sufficient runtime for containersOptions:--config string Location of client config files (default "/home/jwang/.docker")-D, --debug Enable debug mode-H, --host list Daemon socket(s) to connect to-l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")--tls Use TLS; implied by --tlsverify--tlscacert string Trust certs signed only by this CA (default "/home/jwang/.docker/ca.pem")--tlscert string Path to TLS certificate file (default "/home/jwang/.docker/cert.pem")--tlskey string Path to TLS key file (default "/home/jwang/.docker/key.pem")--tlsverify Use TLS and verify the remote-v, --version Print version information and quitManagement Commands:builder Manage buildsconfig Manage Docker configscontainer Manage containersengine Manage the docker engineimage Manage imagesnetwork Manage networksnode Manage Swarm nodesplugin Manage pluginssecret Manage Docker secretsservice Manage servicesstack Manage Docker stacksswarm Manage Swarmsystem Manage Dockertrust Manage trust on Docker imagesvolume Manage volumesCommands:attach Attach local standard input, output, and error streams to a running containerbuild Build an image from a Dockerfilecommit Create a new image from a container's changescp Copy files/folders between a container and the local filesystemcreate Create a new containerdiff Inspect changes to files or directories on a container's filesystemevents Get real time events from the serverexec Run a command in a running containerexport Export a container's filesystem as a tar archivehistory Show the history of an imageimages List imagesimport Import the contents from a tarball to create a filesystem imageinfo Display system-wide informationinspect Return low-level information on Docker objectskill Kill one or more running containersload Load an image from a tar archive or STDINlogin Log in to a Docker registrylogout Log out from a Docker registrylogs Fetch the logs of a containerpause Pause all processes within one or more containersport List port mappings or a specific mapping for the containerps List containerspull Pull an image or a repository from a registrypush Push an image or a repository to a registryrename Rename a containerrestart Restart one or more containersrm Remove one or more containersrmi Remove one or more imagesrun Run a command in a new containersave Save one or more images to a tar archive (streamed to STDOUT by default)search Search the Docker Hub for imagesstart Start one or more stopped containersstats Display a live stream of container(s) resource usage statisticsstop Stop one or more running containerstag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGEtop Display the running processes of a containerunpause Unpause all processes within one or more containersupdate Update configuration of one or more containersversion Show the Docker version informationwait Block until one or more containers stop, then print their exit codesRun 'docker COMMAND --help' for more information on a command.