docker wsl ubantu 18安装 转

原博客地址  https://nickjanetakis.com/blog/setting-up-docker-for-windows-and-wsl-to-work-flawlessly

1. Install Docker on Windows

To install the Docker engine on Windows, just go to docker.com and download the appropriate distribution. Also, make sure hardware virtualization is enabled and Hyper-V is installed, lest the engine won’t start.

Shortcut: Install Windows 10 Creators Update

With Windows 10 Creators Update, accomplishing all of this has become a lot simpler, since it allows you to run Windows executables from Bash. Just add these two lines to your .bashrc (and reload your environment) and you’re done!

export PATH="$HOME/bin:$HOME/.local/bin:$PATH"
export PATH="$PATH:/mnt/c/Program\ Files/Docker/Docker/resources/bin"
alias docker=docker.exe
alias docker-compose=docker-compose.exe

1

2

3

4

export PATH="$HOME/bin:$HOME/.local/bin:$PATH"

export PATH="$PATH:/mnt/c/Program\ Files/Docker/Docker/resources/bin"

alias docker=docker.exe

alias docker-compose=docker-compose.exe

You can now run docker --version from Bash, and you don’t even have to read the rest of this blog post :)

Making it work on Windows 10 Anniversary Edition

To install Docker on the WSL, you’ll need to jump through a few more hoops. There’s a description for Ubuntu in general here, which works for the WSL as well, with the exceptions of some of the optional steps. Here’s what I did:

# Install packages to allow apt to use a repository over HTTPS
$ sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
# Add Docker‘s official GPG key
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# Set up the repository
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# Update source lists
sudo apt-get update
# Install Docker
sudo apt-get install docker-ce

1

2

3

4

5

6

7

8

9

10

# Install packages to allow apt to use a repository over HTTPS

$ sudo apt-get install apt-transport-https ca-certificates curl software-properties-common

# Add Docker‘s official GPG key

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

# Set up the repository

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

# Update source lists

sudo apt-get update

# Install Docker

sudo apt-get install docker-ce

Of course, there’s also the option of downloading and extracting the binaries we’ll need, and put them somewhere in your PATH. There are instructions here for how to get the latest version.

Where did that get us?

We now actually have the Docker engine installed on both Windows and the WSL, but it isn’t started on either. The Windows installer helpfully created a Docker shortcut on the desktop and/or in the Start menu – use that to start the Docker engine. Then, you can try running e.g. docker images from PowerShell and from Bash:

PowerShell:

PS C:\> docker images
REPOSITORY TAG IMAGE ID CREATED SIZE

1

2

PS C:\> docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

We haven’t created any images yet, so that’s fine.

原文地址:https://www.cnblogs.com/nhz-M/p/11044665.html

时间: 2024-11-10 17:48:06

docker wsl ubantu 18安装 转的相关文章

docker for ubuntu 18 安装

官网地址: https://docs.docker.com/install/linux/docker-ce/ubuntu/ docker的作用:解决不同机器之间的环境差异问题,方便迁移. 0. 卸载旧版本sudo apt-get remove docker docker-engine docker.io containerd runc 1. 更新apt:sudo apt-get update 2. 添加证书安装包以允许apt通过HTTPS:sudo apt-get install \ apt-t

Docker Compose 1.18.0 之服务编排详解

一个使用Docker容器的应用,通常由多个容器组成.使用Docker Compose,不再需要使用shell脚本来启动容器.在配置文件中,所有的容器通过services来定义,然后使用docker-compose脚本来启动,停止和重启应用,和应用中的服务以及所有依赖服务的容器Compose 通过一个配置文件来管理多个Docker容器,非常适合组合使用多个容器进行开发的场景. 服务编排工具使得Docker应用管理更为方便快捷. Docker Compose网站:https://docs.docke

docker(二):CentOS安装docker

前置条件 1. CentOS 7:要求系统为64位.系统内核版本为 3.10 以上 使用如下命令,查看机器配置 lsb_release -a uname -a 2. 关闭防火墙 systemctl stop firewalld systemctl disable firewalld 配置yum源(可做) 配置centos7的yum源(阿里云) # 1.进入centos的yum目录 cd /etc/yum.repos.d/ # 2.备份原来的repo文件 mv CentOs-Base.repo C

docker学习1-CentOS 7安装docker环境

前言 Docker 提供轻量的虚拟化,你能够从Docker获得一个额外抽象层,你能够在单台机器上运行多个Docker微容器,而每个微容器里都有一个微服务或独立应用,例如你可以将Tomcat运行在一个Docker,而MySQL运行在另外一个Docker,两者可以运行在同一个服务器,或多个服务器上.未来可能每个应用都要Docker化 环境准备 Docker支持以下的CentOS版本,目前,CentOS 仅发行版本中的内核支持 Docker. Docker 运行在 CentOS 7 (64-bit)上

Docker相关环境全套安装文档兼小技能

Docker相关环境全套安装文档兼小技能 以下环境皆为ubuntu16.04,主要安装docker,docker-compose,docker仓库等. Docker安装 参考官方 A: 有源安装 Ubuntu的 Docker 安装: sudo apt-get remove docker docker-engine docker.io containerd runc sudo apt-get update sudo apt-get install apt-transport-https ca-ce

netcore3.1+jenkins+docker在ubantu中部署

最近由于疫情给了不少时间,之前断断续续做过很多关乎docker的学习,一直敲各种命令,觉得太麻烦了,没继续深入下去,这段时间又琢磨了一阵子,说一说遇到的一些问题,记录一下.ubantu是安装在台式机中的,总觉得虚拟机太麻烦,直接把台式机的机械硬盘电源线拔了,把系统安装到了120g的固态硬盘上,平时闲置的也算做了一些贡献,ubantu上有一些小游戏挺好玩,扯远了... 安装环境就不说了,总体思路就是代码传递到码云,由jenkins下载最新代码,执行dockerfile,运行容器.开始是做的jenk

Docker的ubuntu镜像安装的容器无ifconfig和ping命令的解决

Docker的Ubuntu镜像安装的容器无ifconfig命令和ping命令 解决: apt-get update apt install net-tools       # ifconfig apt install iputils-ping     # ping

【VMCloud云平台】拥抱Docker(一)安装

VMCloud云平台发布到现在已经历史一年,按照原本计划,第二步应该是VMware私有云平台搭建,但是开源实在来得太过凶猛,博主身在战场中深深的感受到了 Docker有很多种安装方式,但是我推荐使用Ubuntu,因为Docker是在ubuntu环境下开发的,所以安装包测试比较充分(难度系数0),这里由于要跟Zabbix.OpenStack等做整合,所以我选择在Azure上搭建Docker,这也是为了实现之前在盆盆老师课程上吹过的牛逼(Microsoft Azure+Windows Azure S

Docker简明教程(以安装wget程序为例)

本文计划: 一.安装Docker(Centos) 二.注册Docker官网帐号 三.下载基础centos镜像,安装需要的软件和环境后,push到自己的repository 一.安装Docker(Centos) 在https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F 中选择自己的epel源. 接着,安装docker-io: $ sudo yum install docker-io 启动Docker dae