Docker 容器操作与功能探索全解析
1. 启动容器
在使用 Docker 时,启动容器是常见操作。此前我们使用docker create命令创建容器,当准备好启动容器时,可使用docker start命令。
以运行 Redis(一个常用的键值存储系统)为例,我们可以按以下步骤操作:
-创建容器:
$ docker create -p 6379:6379 redis:2.8若本地没有该镜像,Docker 会自动从镜像仓库拉取:
Unable to find image 'redis:2.8' locally 30d39e59ffe2: Pull complete ... 868be653dea3: Pull complete 511136ea3c5a: Already exists redis:2.8: The image you are pulling has been verified. Important: ... Status: Downloaded newer image for redis:2.8 6b785f78b75ec2652f81d92721c416ae854bae085eba378e46e8ab54d7ff81d1此命令最后会输出容器生成的完整哈希值。若不知道容器的完整或短哈希值,可使用以下命令列出系统中所有容器(无