Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的Linux或 Windows 操作系统的机器上,也可以实现虚拟化、容器是完全使用沙箱机制,彼此之间没有任何接口。
文章目录
- 1. Docker介绍
- 2. Docker环境安装
- Windows
- Ubuntu
- 3. Docker常用命令
1. Docker介绍
一个完整的Docker有以下几个部分组成:
- DockerClient客户端
- Docker守护进程
- Docker镜像
- Docker容器
2. Docker环境安装
Windows
首先打开Hyper-V虚拟化环境,并用systeminfo
查看。
然后打开地址下载:https://www.docker/products/docker-desktop/
若出现错误hardware assisted virtualization and data execution protection must be enable,执行:bcdedit /set hypervisorlaunchtype Auto
若出现错误Update the WSL kernel by running “wsl --update” or follow instructions ,参考:https://learn.microsoft/en-us/windows/wsl/install-manual#step-4---download-the-linux-kernel-update-package
首先安装WSL2 Linux kernel update package for x64 machines
,
然后配置wsl版本并重启:
wsl --set-default-version 2
测试demo:docker run hello-world
Ubuntu
可以使用国内daocloud的一键安装命令:curl -sSL https://get.daocloud.io/docker | sh
3. Docker常用命令
下面是Docker的常用命令:
Docker常用命令大全
容器生命周期管理命令
run
start/stop/restart
kill
rm
create
exec
pause/unpause
容器操作命令
ps
inspect
top
events
logs
export
port
容器rootfs命令
commit
cp
diff
镜像仓库命令
login/logout
pull
push
search
本地镜像管理命令
images
rmi
tag
build
history
save
load
import
基础版本信息命令
info
version
以上。
更多推荐
【Docker】Docker环境安装与常用命令
发布评论