命令 | 含义 |
---|---|
attach | Attach local standard input, output, and error streams to a running container |
build | Build an image from a Dockerfile |
commit | Create a new image from a container’s changes |
cp | Copy files/folders between a container and the local filesystem |
create | Create a new container |
diff | Inspect changes to files or directories on a container’s filesystem |
events | Get real time events from the server |
exec | Run a command in a running container |
export | Export a container’s filesystem as a tar archive |
history | Show the history of an image |
images | List images |
import | Import the contents from a tarball to create a filesystem image |
info | Display system-wide information |
inspect | Return low-level information on Docker objects |
kill | Kill one or more running containers |
load | Load an image from a tar archive or STDIN |
login | Log in to a Docker registry |
logout | Log out from a Docker registry |
logs | Fetch the logs of a container |
pause | Pause all processes within one or more containers |
port | List port mappings or a specific mapping for the container |
ps | List containers |
pull | Pull an image or a repository from a registry |
push | Push an image or a repository to a registry |
rename | Rename a container |
restart | Restart one or more containers |
rm | Remove one or more containers |
rmi | Remove one or more images |
run | Run a command in a new container |
save | Save one or more images to a tar archive (streamed to STDOUT by default) |
search | Search the Docker Hub for images |
start | Start one or more stopped containers |
stats | Display a live stream of container(s) resource usage statistics |
stop | Stop one or more running containers |
tag | Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE |
top | Display the running processes of a container |
unpause | Unpause all processes within one or more containers |
update | Update configuration of one or more containers |
version | Show the Docker version information |
wait | Block until one or more containers stop, then print their exit codes |
所有终端共用一个界面
一旦退出了容器就结束了
将容器内文件复制到本地
docker cp 066adb168f0c:/etc/nginx/nginx.conf ./
将本地文件复制到容器中
docker cp nginx.conf 066adb168f0c:/etc/nginx/
查看容器和镜像之间的差异
docker diff 066adb168f0c
文件前字符 | 含义 |
---|---|
A | 添加的文件或目录 |
D | 删除的文件或目录 |
C | 修改的文件或目录 |
查看镜像的构建历史
查看容器或者容器的详细内容
分层 | 含义 |
---|---|
LowerDir | 底层目录 |
MergedDir | 合并目录 |
UpperDir | 上传目录 |
WorkDir | 工作目录 |
查看docker 网络信息
查看日志
暂停时容器无法被访问,恢复暂停后访问正常
docker unpause 06
查看容器
docker ps
docker ps -a
docker ps -aq -f status=exited
查看所有容器CPU 内存使用百分比
查看容器进程情况
镜像打标签
docker tag 48bd7f260d7c nginx:v3
docker tag nginx:v3 nginx:v3.1
删除这些已经退出的容器
docker rm -fv `docker ps -aq -f status=exited`
查看docker版本
查看docker的基本信息
更新容器配置
docker update --cpus 1 066adb168f0c
登录harbor仓库
docker login https://harbor.intra.com
退出登录
docker logout https://harbor.intra.com
拉取镜像
docker pull nginx
上传镜像
docker tag nginx:v3 harbor.intra.com/baseimages/nginx:v3
docker push harbor.intra.com/baseimages/nginx:v3
docker push nginx:v2 harbor:5000/nginx/nginx:v2
删除镜像
docker rmi nginx:v3.1
将正在运行的docker保存为image
docker commit ba03ddb16bff nginx:v2
将image保存为文件
docker save -o nginx.v2.tar.gz nginx:v2
将文件导入为镜像
docker load -i nginx.v2.tar.gz