Skip to content

Ananyakumarisingh/Docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Docker

Containers

Your basic isolated Docker process. Containers are to virtual machines, as threads are to processes. Or you can think of them as larger-than-life chroot environments.

Lifecycle

  • docker create - Creates a container but doesn't start it
  • docker rename - Allows the container to be renamed
  • docker run - Creates and start a container in one operation
  • docker rm - Deletes a container
  • docker update - Updates a container's resource limits
  • docker run --rm - Removes container when stopped
  • docker run -v $HOSTDIR-$DOCKERDIR - Maps a directory on the host to the Docker container; see also Volumes
  • docker run -v - Removes volumes associed with container
  • docker run --log-driver=syslog - Runs Docker with custom log driver

Starting and Stopping

  • docker start - Starts a container, so it is running
  • docker stop - Stops a running container
  • docker restart - Stops and starts a container
  • docker pause - Pauses a running container, "freezing" it in place
  • docker unpause - Unpauses a running container
  • docker run wait - Blocks until running container stops
  • docker run kill - Sends a SIGKILL to a running container
  • docker run attach - Connects to a running container

If you want to integrate a container with a hpst process manager, start the daemon with -r=false then use docker start -a.

If you want to expose container ports through the host, see the exposing ports section.

Information on Docker Containers, Processes and Performance

  • docker ps - Shows running containers
  • docker logs - Gets logs from container; you can use a custom log driver, but logs are only available for json-file and journald in 1.10
  • docker inspect - Looks at all info on a container (including IP address)
  • docker evens - Gets events from container
  • docker port - Shows public facing port to container
  • docker top - Shows running processes in container
  • docker stats - Shows containers' resource usage statistics
  • docker diff - Shows changed files in the container's filesystem
  • docker ps -a - Shows running and stopped containers
  • docker stats --all - Shows a running list of containers

Import/Export (Backup/Restore)

  • docker cp - Copies files or folders between a container and the local filesystem
  • docker export - Turns container filesystem into tarball archive stream to STDOUT

Executing Commands

  • docker exec - Executes a command in container

To enter a running container, attach a new shell process to a running container called foo, use:

docker exec -it foo /bin/bash

Images

Images are templates that Docker containers are based on. They are the foundation layer from which your container is launched, and your changed then become independent from it (as another layer)

Lifecycle of Containers (Create, Run , Build, Commit)

  • docker images - Shows all images
  • docker import - Creates image from a tarball
  • docker build - Creates image from Dockerfile
  • docker commit - Creates an image from a container, pausing it temporarily if it is running
  • docker rmi - Removes an image
  • docker load - Removes an image from a tar archive as STDIN, including images and tags (as of 0.7)
  • docker save - Saves an image to a tar archive stream to STDOUT with all parent layers, tags and versions (as of 0.7)

Info

  • docker history - Shows history of image
  • docker tag - Tags an image to a name (local or registry)

Cleaning up

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors