Docker安裝及使用

llla發表於2018-11-25

安裝參考官網

    Uninstall old versions
        ``#$ sudo apt-get remove docker docker-engine docker.io
    Install using the repository
        SET UP THE REPOSITORY
            1.Update the apt package index:
                ``#$ sudo apt-get update
            2.Install packages to allow apt to use a repository over HTTPS:
                ``#$ sudo apt-get install \
                    ``#apt-transport-https \
                    ``#ca-certificates \
                    ``#curl \
                    ``#software-properties-common
            3.Add Docker’s official GPG key:
                ``#curl -fsSL https://download.docker.com/linux/ubuntu/gpg | 
                ``#sudo apt-key add -
        Verify that you now have the key with the fingerprint
            ``#$ sudo apt-key fingerprint 0EBFCD88

                ``#pub   4096R/0EBFCD88 2017-02-22
                      ``#Key fingerprint = 9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C ``#0EBF CD88
                ``#uid                  Docker Release (CE deb) <docker@docker.com>
                ``#sub   4096R/F273FCD8 2017-02-22
    INSTALL DOCKER CE
        1.Update the apt package index.
            ``#$ sudo apt-get update
        2.Install the latest version of Docker CE, or go to the next step to
        install a specific version:
            ``#sudo apt-get install docker-ce
        3.To install a specific version of Docker CE, list the available
        versions in the repo, then select and install:
            a. List the versions available in your repo:
                ``#$ apt-cache madison docker-ce
            b. Install a specific version by its fully qualified package name
                ``#$ sudo apt-get install docker-ce=<VERSION>
                ``#exapmle: docker-ce=18.03.0~ce-0~ubuntu
    Uninstall Docker CE
        1.Uninstall the Docker CE package:
            ``#$ sudo apt-get purge docker-ce
        2.Images, containers, volumes, or customized configuration files
        on your host are not automatically removed. To delete all images, containers, and volumes:
            ``#$ sudo rm -rf /var/lib/docker
        You must delete any edited configuration files manually.
複製程式碼

基礎命令使用:

docker --version/docker -v 檢視版本
docker info/ (docker version without --)  檢視docker安裝詳細資訊
docker image ls/docker images 檢視image列表
docker container ls --all/docker ps -a&emsp;檢視所有狀態container
docker save -o update1.tar update 映象備份
docker load < update1.tar 載入映象
複製程式碼

相關文章