Docker安装及基本命令(课时2~5)

docker 安装

这里主要介绍 linux 、Windows 10 和 macOS 上的安装。

linux

$ sudo curl -sS https://get.docker.com/ | sh

测试

$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
d1725b59e92d: Pull complete
Digest: sha256:0add3ace90ecb4adbf7777e9aacf18357296e799f81cabc9fde470971e499788
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/
For more examples and ideas, visit:
 https://docs.docker.com/get-started/

*如果机器有支持深度学习的Gpu,可以继续执行如下命令以支持容器对gpu的调用[目前仅支持linux]:

# Add the package repositories
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list


sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart docker

windows

手动下载安装 点击以下链接下载 Stable (opens new window)或 Edge (opens new window)版本的 Docker Desktop for Windows。 下载好之后双击 Docker Desktop Installer.exe 开始安装。 使用 winget (opens new window)安装


                
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Linux Docker是一个开源的容器管理平台,它使用户能够在虚拟化环境中运行和部署应用程序。下面是关于Linux Docker安装基本命令的解释: 1. 安装:在Linux中安装Docker需要运行一系列的命令。请访问官方网站(https://www.docker.com/)查找适合您的操作系统的安装程序。安装完成后,您需要配置Docker,将Docker服务启动,并将它与操作系统一起启动。 2. 启动:启动Docker容器可以使用“docker run”命令。这条命令会将您的容器启动,并返回一个容器ID号。如果您想更加详细地了解容器信息,您可以使用“docker ps”命令查询关于Docker容器的信息。 3. 停止:停止运行Docker容器可以使用以下命令: - Docker stop [容器 ID]:停止Docker容器。 - Docker rm [容器 ID]:删除Docker容器。 4. 构建镜像:当您需要一种特定的应用程序时,您可以构建一个Docker映像。这可以通过“docker build”命令来实现,您需要提供一个Dockerfile,它是用于指定映像内容的文件。 5. 导入和导出:您可以将您的Docker容器导入或者导出。此操作可以实现Docker容器的迁移或者备份。命令如下: - 导入:docker import [容器名称][路径或URL]。 - 导出:docker save -o [文件名].tar [容器名称]。 总之,上述是关于Linux Docker安装基本命令的解释。更多有关Docker的信息,请访问官方文档(https://docs.docker.com/)。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值