docker run

  1. docker run -d --name container1 ubuntu:latest /bin/sh -c "while true; do echo hello world; sleep 1; done"

dockerrun并查看container状态

docker - 图1

挂载

  1. docker run -d --name container_mount_demo --mount type=bind,source=/home/tml/boo/data,target=/opt ubuntu:latest /bin/sh -c "while true; do echo hello world; sleep 1; done"

docker - 图2

验证挂载

docker - 图3

进入容器

  1. docker exec -it container_mount_demo bash

docker - 图4

dockerfile安装net-tools

  1. FROM ubuntu:latest
  2. RUN apt-get update \
  3. && apt-get install -y net-tools
  1. docker build -t ubuntu:net_tools .

docker - 图5