Docker
122 words
One minute
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
Option | Description |
–name | Name |
-i | Keep STDIN open even if not attached |
-t | Allocate a pseudo-TTY |
exec
options
Option | Description |
-i | interaction |
-t | terminal |
-w | workspace |
start
1
| docker attach docker_name/docker_id [-i]
|
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]
|