亚洲最大看欧美片,亚洲图揄拍自拍另类图片,欧美精品v国产精品v呦,日本在线精品视频免费

  • 站長(zhǎng)資訊網(wǎng)
    最全最豐富的資訊網(wǎng)站

    wsl 可以安裝docker么

    wsl可以安裝docker,其安裝方法:1、安裝并配置wsl;2、在官網(wǎng)下載安裝docker for windows;3、通過(guò)pip來(lái)安裝docker-compose即可。

    wsl 可以安裝docker么

    本文操作環(huán)境:Ubuntu18.06系統(tǒng)、Docker-CE版、Dell G3電腦。

    wsl 可以安裝docker么?

    wsl 下安裝docker

    docker for windows本身其實(shí)是可以直接用的,但是仍然有很多不足,比如說(shuō):權(quán)限問(wèn)題、沒(méi)有docker.sock文件、文件編碼問(wèn)題等。而win10自帶的wsl可以非常完美地解決這些問(wèn)題。

    安裝wsl

    首先在 程序和功能->啟用和關(guān)閉windows功能中打開(kāi)適用于Linux的Windows子系統(tǒng)

    然后打開(kāi)微軟應(yīng)用商店,直接搜索Ubuntu,選擇18.06版本的ubuntu安裝

    wsl配置

    首先配置阿里云鏡像,vim /etc/apt/sources.list

    deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse  deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse  deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse  deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse  deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

    然后更新源

    apt update

    默認(rèn)情況下,windows的目錄會(huì)自動(dòng)掛載(mount)到wsl中的/mnt目錄下,但是這樣會(huì)導(dǎo)致后面的docker的相對(duì)路徑問(wèn)題。所以修改配置文件 /etc/wsl.conf

    [automount] root = / options = "metadata,umask=22,fmask=11"

    這樣,windows里面的c盤(pán)就自動(dòng)掛載到了wsl中的/c/目錄下,d盤(pán)就自動(dòng)掛載到了wsl中的/d/目錄下

    安裝docker for windows

    直接到官網(wǎng)上下載安裝即可。

    安裝的時(shí)候,因?yàn)槲覀円褂脀sl中的docker,也就是linux container,所以記得不要選擇windows container。

    安裝好了之后,先配置加速器,目前我用阿里云和daocloud的加速器,都挺快的。到對(duì)應(yīng)的網(wǎng)站上按照指示操作即可。

    開(kāi)發(fā)的時(shí)候,需要把物理機(jī)上的代碼和容器中的代碼文件做共享,所以需要在Shared Drives中配置共享的盤(pán)符。你的代碼在哪個(gè)盤(pán)里面,那么就選擇共享哪個(gè)盤(pán)

    wsl中安裝docker

    如果直接用apt來(lái)安裝docker,不會(huì)是最新版的,所以參考官方文檔來(lái)安裝最新版的docker(https://docs.docker.com/install/linux/docker-ce/ubuntu/)

    即:

    sudo apt-get remove docker docker-engine docker.iosudo apt-get updatesudo apt-get install      apt-transport-https      ca-certificates     curl      software-properties-commoncurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -sudo apt-key fingerprint 0EBFCD88sudo add-apt-repository    "deb [arch=amd64] https://download.docker.com/linux/ubuntu    $(lsb_release -cs)     stable"sudo apt-get updatesudo apt-get install docker-ce

    試一下執(zhí)行docker命令:

    docker version

    結(jié)果如下:

    Client:  Version:      18.03.1-ce  API version:  1.37  Go version:   go1.9.5  Git commit:   9ee9f40  Built:        Wed Jun 20 21:43:51 2018  OS/Arch:      linux/amd64  Experimental: false  Orchestrator: swarm  Server:  Engine:   Version:      18.03.1-ce   API version:  1.37 (minimum version 1.12)   Go version:   go1.9.5   Git commit:   9ee9f40   Built:        Thu Apr 26 07:22:38 2018   OS/Arch:      linux/amd64   Experimental: false

    OK了,但是如果再run一下呢?

    docker run busybox

    此時(shí)會(huì)提示docker daemon沒(méi)有運(yùn)行。那么執(zhí)行:

    sudo service docker start

    雖然看到is starting,但是docker還是不能run。

    此時(shí),就需要打開(kāi)docker for windows中的General->Expose daemon on tcp://localhost:2375 without TLS

    然后在wsl中執(zhí)行:

    export DOCKER_HOST=tcp://localhost:2375

    然后就可以開(kāi)始run了。

    推薦學(xué)習(xí):《Docker視頻教程》

    另外默認(rèn)情況下是不會(huì)安裝docker-compose的,如果通過(guò)apt來(lái)安裝docker-compose,也不會(huì)是最新版,但是通過(guò)pip來(lái)安裝的就是最新版,所以:

    sudo apt install python-pipsudo pip install docker-compose

    測(cè)試下:

    docker-compose version

    贊(0)
    分享到: 更多 (0)
    網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)