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

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

    wsl 可以安裝docker么

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

    wsl 可以安裝docker么

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

    wsl 可以安裝docker么?

    wsl 下安裝docker

    docker for windows本身其實是可以直接用的,但是仍然有很多不足,比如說:權限問題、沒有docker.sock文件、文件編碼問題等。而win10自帶的wsl可以非常完美地解決這些問題。

    安裝wsl

    首先在 程序和功能->啟用和關閉windows功能中打開適用于Linux的Windows子系統(tǒ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

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

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

    這樣,windows里面的c盤就自動掛載到了wsl中的/c/目錄下,d盤就自動掛載到了wsl中的/d/目錄下

    安裝docker for windows

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

    安裝的時候,因為我們要使用wsl中的docker,也就是linux container,所以記得不要選擇windows container。

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

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

    wsl中安裝docker

    如果直接用apt來安裝docker,不會是最新版的,所以參考官方文檔來安裝最新版的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

    結果如下:

    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

    此時會提示docker daemon沒有運行。那么執(zhí)行:

    sudo service docker start

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

    此時,就需要打開docker for windows中的General->Expose daemon on tcp://localhost:2375 without TLS

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

    export DOCKER_HOST=tcp://localhost:2375

    然后就可以開始run了。

    推薦學習:《Docker視頻教程》

    另外默認情況下是不會安裝docker-compose的,如果通過apt來安裝docker-compose,也不會是最新版,但是通過pip來安裝的就是最新版,所以:

    sudo apt install python-pipsudo pip install docker-compose

    測試下:

    docker-compose version

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