Skip to content

NOTE20190328

Somkiat Puisungnoen edited this page Jul 26, 2019 · 1 revision

Manage command

# Manage image
$docker image pull hello-world
$docker image ls
$docker image rm hello-world
$docker image rm $(docker image ls -q)
$docker image prune

# Manage container
$docker container run hello-world
$docker container run --rm hello-world
$docker container rm <container id/name>
$docker container rm $(docker container ps -a -q)
$docker container prune

Create first container

# Create a container from nginx:1.15.10 image
$docker container run -d nginx:1.15.10

# Detail of container
$docker container inspect 702a326628e2

# Access to container
$docker container exec -it 88a397630e607 bash

# See changes in of container
$docker container diff 702a326628e2

# Save container to image
docker container commit 702a326628e2 nginx_with_curl:0.1
#apt update
#apt install curl -y

# Create container again
docker container run -d nginx_with_curl:0.1
  • Compile with Apache Maven
  • Build image
  • Push image to docker hub and Docker registry (local)
  • Create container
Clone this wiki locally