Skip to content
SaeHie Park edited this page Jun 7, 2020 · 14 revisions

Install

Follow https://docs.docker.com/engine/install/ubuntu/

Basic

Build with Dockerfile

cat Dockerfile | docker build -t myimage -

Build with Dockerfile not using cache

cat Dockerfile | docker build --no-cache -t myimage -

Run with image

docker run -it -v /volumeHost:/volumeDocker myimage bash

Commands

  • docker images
  • docker images -a
  • docker images -f "dangling=true"
  • docker ps -a
  • docker rm container_id
  • docker rmi image_id

from https://docs.docker.com/get-started/part2/

docker build -t friendlyhello .  # Create image using this directory's Dockerfile
docker run -p 4000:80 friendlyhello  # Run "friendlyhello" mapping port 4000 to 80
docker run -d -p 4000:80 friendlyhello         # Same thing, but in detached mode
docker container ls                                # List all running containers
docker container ls -a             # List all containers, even those not running
docker container stop <hash>           # Gracefully stop the specified container
docker container kill <hash>         # Force shutdown of the specified container
docker container rm <hash>        # Remove specified container from this machine
docker container rm $(docker container ls -a -q)         # Remove all containers
docker image ls -a                             # List all images on this machine
docker image rm <image id>            # Remove specified image from this machine
docker image rm $(docker image ls -a -q)   # Remove all images from this machine
docker login             # Log in this CLI session using your Docker credentials
docker tag <image> username/repository:tag  # Tag <image> for upload to registry
docker push username/repository:tag            # Upload tagged image to registry
docker run username/repository:tag                   # Run image from a registry

Proxy

https://docs.docker.com/v1.13/engine/admin/systemd/#http-proxy

Query

docker.someservice.com/v2/_catalog
docker.someservice.com/v2/_catalog?n=100
docker.someservice.com/v2/_catalog?n=100&last=100
docker.someservice.com/v2/(name/sub)/tags/list

Problem solving

Disable debconf warnings:

ENV DEBIAN_FRONTEND=noninteractive

Reference

Clone this wiki locally