Skip to content

Instantly share code, notes, and snippets.

@ChechoCZ
Last active April 21, 2020 12:15
Show Gist options
  • Save ChechoCZ/e2f9c5e371dbd6af71ee88cd5dcc7fc2 to your computer and use it in GitHub Desktop.
Save ChechoCZ/e2f9c5e371dbd6af71ee88cd5dcc7fc2 to your computer and use it in GitHub Desktop.
// take an image from Docker Hub
docker pull image-name
// run a container
// pc-port:container-port
docker run --name my-custom-name -p xxxx:xxxx -d image-name
// list running containers
docker ps
// list all the containers
docker ps -a
// remove a container
docker rm ID (first 3 characters)
// start a container
docker start image-name
// list images on local machine
docker images
// remove an image
docker image rm image_id (first 3 characters)
// mount volumes:
docker run -p xxxx:xxxx -v /var/www image (ex: node)
// remove volume:
docker rm -v container_id (first 3 characters)
// run a project (ex: express project) within a container
docker run -p xxxx:xxxx -v $(pwd):/var/www -w "/var/www" node npm start
// inspect a container
docker inspect container_id (first 3 characters) || container_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment