-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker
More file actions
44 lines (29 loc) · 1.78 KB
/
docker
File metadata and controls
44 lines (29 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
docker run --name merchant-mysql --restart always -p 3306:3306 -v /opt/dockerVolumes/mysql-data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:8
docker run --name merchant-redis --restart always -p 6379:6379 -d redis --requirepass 123456
----------------------------------------------------------------------------------------------------------------------
install docker ce
Install using the repository:(https://docs.docker.com/install/linux/docker-ce/centos/#set-up-the-repository)
1, yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
2,yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
3,yum-config-manager --enable docker-ce-edge
yum-config-manager --enable docker-ce-test
4,yum install docker-ce
5,Start Docker:systemctl start docker
6,test it:docker run hello-world
--------------------------------------------------------------------------------------------------------------------------
概念,组件,关系:
镜像 vs 容器
An instance of an image is called a container. You have an image, which is a set of layers as you describe. If you start this image,
you have a running container of this image. You can have many running containers of the same image.
You can see all your images with docker images whereas you can see your running containers with docker ps
(and you can see all containers with docker ps -a).
So a running instance of an image is a container.
Volume就是目录或者文件,它可以绕过默认的联合文件系统,而以正常的文件或者目录的形式存在于宿主机上。
-------------------------------------------------------------------------------------------------
命令:
docker ps 列出容器
docker rm -f $(docker ps -aq) 杀掉所有容器