<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # 1.9.1 Docker的安裝 ## Docker 是什么 {#Docker入門-Docker是什么} Docker 是一種容器技術,它可以將應用和環境等進行打包,形成一個獨立的,類似于 iOS 的 APP 形式的「應用」,這個應用可以直接被分發到任意一個支持 Docker 的環境中,通過簡單的命令即可啟動運行。Docker 是一種最流行的容器化實現方案。和虛擬化技術類似,它極大的方便了應用服務的部署;又與虛擬化技術不同,它以一種更輕量的方式實現了應用服務的打包。使用 Docker 可以讓每個應用彼此相互隔離,在同一臺機器上同時運行多個應用,不過他們彼此之間共享同一個操作系統。Docker 的優勢在于,它可以在更細的粒度上進行資源的管理,也比虛擬化技術更加節約資源。 [官方文檔](http://guide.daocloud.io/dcs/docker-9152673.html) ### 1. 相關鏈接 {#1-相關鏈接} * 官方網站:[https://www.docker.com](https://www.docker.com/) * GitHub:[https://github.com/docker](https://github.com/docker) * Docker Hub:[https://hub.docker.com](https://hub.docker.com/) * 官方文檔:[https://docs.docker.com](https://docs.docker.com/) * DaoCloud:[http://www.daocloud.io](http://www.daocloud.io/) * 中文社區:[http://www.docker.org.cn](http://www.docker.org.cn/) * 中文教程:[http://www.runoob.com/docker/docker-tutorial.html](http://www.runoob.com/docker/docker-tutorial.html) * 推薦書籍:[https://yeasy.gitbooks.io/docker\_practice](https://yeasy.gitbooks.io/docker_practice) ### 2.在windows下安裝 Windows10 64位安裝:推薦使用 [Docker for Windows](https://docs.docker.com/docker-for-windows/install/) 非Windows10 64位系統安裝:[https://docs.docker.com/toolbox/toolbox\_install\_windows/](https://docs.docker.com/toolbox/toolbox_install_windows/) 這里以VMware Workstation為例: #### 環境: * Hyper-V:已卸載 * VMware:已安裝 * Virtual Box:無安裝 #### 驅動 下載地址:[https://github.com/pecigonzalo/docker-machine-vmwareworkstation/releases/latest](https://github.com/pecigonzalo/docker-machine-vmwareworkstation/releases/latest) #### 復制 * 通過InstallDocker.msi安裝的,復制到C:\Program Files\Docker\Docker\resources\bin下 * 通過DockerToolbox.exe安裝的,復制到C:\Program Files\Docker Toolbox下 #### 打開**git-bash**,輸入以下命令: `docker-machine ls` ![](https://box.kancloud.cn/41be1c56d0f014559a6cfa372b1197e7_707x127.png) 檢查是否有machine實例,如果有,請考慮是否卸載它 ```text docker-machine stop dev && docker-machine rm dev ``` 停止NAME為default的machine實例 ```text docker-machine stop default ``` 刪除NAME為default的machine實例 ```text docker-machine rm default ``` 創建一個名稱為default的machine實例 ```text docker-machine create --driver=vmwareworkstation default ``` 啟用 ```text docker-machine active default ``` ## 使用[Docker Toolbox](https://docs.docker.com/toolbox/toolbox_install_windows/)進行安裝 1. 不使用VirtualBox安裝Docker Toolbox `DockerToolbox-.exe /COMPONENTS="Docker,DockerMachine"` 2. `C:\Program Files\Docker Toolbox\start.sh`用此腳本替換內容。 ```text !/bin/bash export PATH="$PATH:/mnt/c/Program Files (x86)/VMware/VMware Workstation" trap '[ "$?" -eq 0 ] || read -p "Looks like something went wrong in step ′$STEP′... Press any key to continue..."' EXIT VM=${DOCKER_MACHINE_NAME-default} DOCKER_MACHINE=./docker-machine.exe BLUE='\033[1;34m' GREEN='\033[0;32m' NC='\033[0m' if [ ! -f "${DOCKER_MACHINE}" ]; then echo "Docker Machine is not installed. Please re-run the Toolbox Installer and try again." exit 1 fi vmrun.exe list | grep \""${VM}"\" &> /dev/null VM_EXISTS_CODE=$? set -e STEP="Checking if machine $VM exists" if [ $VM_EXISTS_CODE -eq 1 ]; then "${DOCKER_MACHINE}" rm -f "${VM}" &> /dev/null || : rm -rf ~/.docker/machine/machines/"${VM}" #set proxy variables if they exists if [ -n ${HTTP_PROXY+x} ]; then PROXY_ENV="$PROXY_ENV --engine-env HTTP_PROXY=$HTTP_PROXY" fi if [ -n ${HTTPS_PROXY+x} ]; then PROXY_ENV="$PROXY_ENV --engine-env HTTPS_PROXY=$HTTPS_PROXY" fi if [ -n ${NO_PROXY+x} ]; then PROXY_ENV="$PROXY_ENV --engine-env NO_PROXY=$NO_PROXY" fi "${DOCKER_MACHINE}" create -d vmwareworkstation $PROXY_ENV "${VM}" fi STEP="Checking status on $VM" VM_STATUS="$(${DOCKER_MACHINE} status ${VM} 2>&1)" if [ "${VM_STATUS}" != "Running" ]; then "${DOCKER_MACHINE}" start "${VM}" yes | "${DOCKER_MACHINE}" regenerate-certs "${VM}" fi STEP="Setting env" eval "$(${DOCKER_MACHINE} env --shell=bash ${VM})" STEP="Finalize" clear cat << EOF ## . ## ## ## == ## ## ## ## ## === /"""""""""""""""""\___/ === ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~ \______ o __/ \ \ __/ \____\_______/ EOF echo -e "${BLUE}docker${NC} is configured to use the ${GREEN}${VM}${NC} machine with IP ${GREEN}$(${DOCKER_MACHINE} ip ${VM})${NC}" echo "For help getting started, check out the docs at https://docs.docker.com " echo cd docker () { MSYS_NO_PATHCONV=1 docker.exe "$@" } export -f docker if [ $# -eq 0 ]; then echo "Start interactive shell" exec "$BASH" --login -i else echo "Start shell with command" exec "$BASH" -c "$*" fi ``` 然后與上面同樣的操作 ### Linux下的安裝 {#3-linux下的安裝} ### 卸載舊版本 {#uninstall-old-versions} ```text $sudoapt-get remove docker docker-engine docker.io ``` ### 使用 APT 安裝 {#使用-apt-安裝} 由于`apt`源使用 HTTPS 以確保軟件下載過程中不被篡改。因此,我們首先需要添加使用 HTTPS 傳輸的軟件包以及 CA 證書。 ```text $ sudo apt-get update $ sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ software-properties-common ``` 鑒于國內網絡問題,強烈建議使用國內源,官方源請在注釋中查看。 為了確認所下載軟件包的合法性,需要添加軟件源的`GPG`密鑰。 ```text $ curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add - # 官方源 # $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - ``` 然后,我們需要向`source.list`中添加 Docker 軟件源 ```text $ sudo add-apt-repository \ "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu \ $(lsb_release -cs) \ stable" # 官方源 # $ sudo add-apt-repository \ # "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ # $(lsb_release -cs) \ # stable" ``` > 以上命令會添加穩定版本的 Docker CE APT 鏡像源,如果需要測試或每日構建版本的 Docker CE 請將 stable 改為 test 或者 nightly。 #### 安裝 Docker CE {#安裝-docker-ce} 更新 apt 軟件包緩存,并安裝`docker-ce`: ```text $ sudo apt-get update $ sudo apt-get install docker-ce ``` ### 使用腳本自動安裝 {#使用腳本自動安裝} 在測試或開發環境中 Docker 官方為了簡化安裝流程,提供了一套便捷的安裝腳本,Ubuntu 系統上可以使用這套腳本安裝: ```text $ curl -fsSL get.docker.com -o get-docker.sh $ sudo sh get-docker.sh --mirror Aliyun ``` 執行這個命令后,腳本就會自動的將一切準備工作做好,并且把 Docker CE 的 Edge 版本安裝在系統中。 ### 啟動 Docker CE {#啟動-docker-ce} ```text $ sudo systemctl enable docker $ sudo systemctl start docker ``` Ubuntu 14.04 請使用以下命令啟動: ```text $ sudo service docker start ``` ### 驗證安裝 ```text docker run hello-world ``` ### 修改 Docker 源為國內源 執行`docker-machine.exe ssh default` 接下來修改配置文件`sudo vi /var/lib/boot2docker/profile` 在`--label provider=vmwareworkstation`的下一行添加`--registry-mirror https://registry.docker-cn.com` 保存后運行退出 ssh 運行`docker-machine restart`
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看