Contents

Docker

Dockerfile

ubuntu timezone

1
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata

Docker command

run

1
2
3
4
docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

# example
docker run -it --name sample_docker ubuntu:20.04 /bin/bash

description

  • 创建和启动一个新的容器实例
  • create and start a new container instance

options

OptionDescription
–nameName
-iKeep STDIN open even if not attached
-tAllocate a pseudo-TTY

exec

description

  • 已运行的容器中, 执行命令

options

OptionDescription
-iinteraction
-tterminal
-wworkspace

start

1
docker attach docker_name/docker_id [-i]
  • -i interact

volume

1
docker run -v /local_path:/docker_path -it --name sample_docker ubuntu:20.04 /bin/bash

attach

1
docker attach [docker_name/docker_id]