hudada-cli
Version:
专为程序员准备的本地文档搜索,快捷开发工具
224 lines (194 loc) • 10.7 kB
Markdown
docker
===
容器化技术,可以将应用程序及其依赖项打包到一个可移植的容器中,使其可以在不同的环境中运行
Docker 容器可以快速部署、可移植、可扩展,并且可以在不同的平台上运行。Docker 可以帮助开发人员和运维人员更轻松地构建、发布和管理应用程序。
在 Linux 中输入以下命令安装 Docker。
```bash
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
yum install -y yum-utils
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo systemctl start docker
```
```shell
docker create [options] IMAGE
```
```shell
attach 将本地标准输入、输出和错误流附加到正在运行的容器
build 从 Dockerfile 构建镜像
commit 从容器的更改创建新镜像
cp 在容器和本地文件系统之间复制文件/文件夹
create 创建一个新容器
diff 检查容器文件系统上文件或目录的更改
events 从服务器获取实时事件
exec 在正在运行的容器中运行命令
export 将容器的文件系统导出为 tar 存档
history 显示镜像的历史
images 列出镜像
import 从 tarball 导入内容以创建文件系统映像
info 显示系统范围的信息
inspect 返回有关 Docker 对象的低级信息
kill 杀死一个或多个正在运行的容器
load 从 tar 存档或 STDIN 加载镜像
login 登录到 Docker 注册表
logout 从 Docker 注册表中注销
logs 获取容器的日志
pause 暂停一个或多个容器内的所有进程
port 列出容器的端口映射或特定映射
ps 列出容器
pull 从注册表中提取镜像或存储库
push 将镜像或存储库推送到注册表
rename 重命名容器
restart 重启一个或多个容器
rm 移除一个或多个容器
rmi 移除一张或多张镜像
run 在新容器中运行命令
save 将一个或多个镜像保存到 tar 存档(默认流式传输到 STDOUT)
search 在 Docker Hub 中搜索镜像
start 启动一个或多个停止的容器
stats 显示容器资源使用统计的实时流
stop 停止一个或多个正在运行的容器
tag 创建一个引用 SOURCE_IMAGE 的标记 TARGET_IMAGE
top 显示容器的运行进程
unpause 取消暂停一个或多个容器中的所有进程
update 更新一个或多个容器的配置
version 显示 Docker 版本信息
wait 阻塞直到一个或多个容器停止,然后打印它们的退出代码
<环境参数>
--add-host list
-a, --attach list
--blkio-weight uint16
--blkio-weight-device list
--cap-add list
--cap-drop list
--cgroup-parent string
--cgroupns string
--cidfile string
--cpu-period int
--cpu-quota int
--cpu-rt-period int
--cpu-rt-runtime int
-c, --cpu-shares int
--cpus decimal
--cpuset-cpus string
--cpuset-mems string
--device list
--device-cgroup-rule list
--device-read-bps list
--device-read-iops list
--device-write-bps list
--device-write-iops list
--disable-content-trust
--dns list
--dns-option list
--dns-search list
--domainname string
--entrypoint string
-e, --env list
--env-file list
--expose list
--gpus gpu-request
--group-add list
--health-cmd string
--health-interval duration
--health-retries int
--health-start-period duration
--health-timeout duration
--help
-h, --hostname string
--init
-i, --interactive
--ip string
--ip6 string
--ipc string
--isolation string
--kernel-memory bytes
-l, --label list
--label-file list
--link list
--link-local-ip list
--log-driver string
--log-opt list
--mac-address string
-m, --memory bytes
--memory-reservation bytes
--memory-swap bytes
--memory-swappiness int
--mount mount
--name string
--network network
--network-alias list
--no-healthcheck
--oom-kill-disable
--oom-score-adj int
--pid string
--pids-limit int
--platform string
--privileged
-p, --publish list
-P, --publish-all
--pull string
--read-only
--restart string
--rm
--runtime string
--security-opt list
--shm-size bytes
--stop-signal string
--stop-timeout int
--storage-opt list
--sysctl map
--tmpfs list
-t, --tty
--ulimit ulimit
-u, --user string
--userns string
--uts string
-v, --volume list
--volume-driver string
--volumes-from list
-w, --workdir string
```
介绍几个常用场景:Docker Hub镜像市场相关,镜像仓库命令。
1、下载docker hub镜像市场中的镜像。
```bash
docker pull user/image
```
2、在 docker hub 中搜索镜像。
```bash
docker search search_word
```
3、向 docker hub 进行身份验证。
```bash
docker login
```
4、将镜像上传到 docker hub。
```bash
docker push user/image
```
更多安装使用方法可以访问学习:https://wangchujiang.com/reference/docs/docker.html
由上海 屠天煜编写