<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ### 寫在前面 之前寫過一篇關于docker安裝的博客,那種方式安裝有很多缺點。運行docker和使用docker的時候會產生多個進程,占用Linux主機的資源。于是,我找到了新的方式安裝docker。 ### 重要的三個文件 ```bash /usr/lib/systemd/system/docker.service /usr/lib/systemd/system/docker.socket /usr/lib/systemd/system/containerd.service ``` ## 開始安裝docker ### 添加docker用戶 ```bash groupadd docker ``` ### 下載docker ```bash https://download.docker.com/linux/static/stable/x86_64/docker-20.10.7.tgz ``` ### 解壓 ```bash tar xzvf docker-20.10.7.tgz ``` ### 復制文件到/usr/bin/ 目錄下 ```bash cp docker/* /usr/bin/ ``` `建議把docker文件復制到/usr/bin/目錄下,如果移動到別的目錄有點問題,systemctl腳本啟動不起來。` ### 創建docker.socket文件 ```bash cat > /usr/lib/systemd/system/docker.socket << 'EOF' [Unit] Description=Docker Socket for the API [Socket] ListenStream=/var/run/docker.sock SocketMode=0660 SocketUser=root SocketGroup=docker [Install] WantedBy=sockets.target EOF ``` ### 創建containerd.service文件 ```bash cat > /usr/lib/systemd/system/containerd.service << 'EOF' # Copyright The containerd Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. [Unit] Description=containerd container runtime Documentation=https://containerd.io After=network.target local-fs.target [Service] ExecStartPre=-/sbin/modprobe overlay ExecStart=/usr/bin/containerd Type=notify Delegate=yes KillMode=process Restart=always RestartSec=5 # Having non-zero Limit*s causes performance problems due to accounting overhead # in the kernel. We recommend using cgroups to do container-local accounting. LimitNPROC=infinity LimitCORE=infinity LimitNOFILE=1048576 # Comment TasksMax if your systemd version does not supports it. # Only systemd 226 and above support this version. TasksMax=infinity OOMScoreAdjust=-999 [Install] WantedBy=multi-user.target EOF ``` ### 創建docker.server文件 ```bash tee /usr/lib/systemd/system/docker.service <<-'EOF' [Unit] Description=Docker Application Container Engine Documentation=https://docs.docker.com After=network-online.target firewalld.service containerd.service Wants=network-online.target Requires=docker.socket containerd.service [Service] Type=notify # the default is not to use systemd for cgroups because the delegate issues still # exists and systemd currently does not support the cgroup feature set required # for containers run by docker ExecStart=/usr/bin/dockerd --graph=/data/docker -H fd:// --containerd=/run/containerd/containerd.sock ExecReload=/bin/kill -s HUP $MAINPID TimeoutSec=0 RestartSec=2 Restart=always # Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229. # Both the old, and new location are accepted by systemd 229 and up, so using the old location # to make them work for either version of systemd. StartLimitBurst=3 # Note that StartLimitInterval was renamed to StartLimitIntervalSec in systemd 230. # Both the old, and new name are accepted by systemd 230 and up, so using the old name to make # this option work for either version of systemd. StartLimitInterval=60s # Having non-zero Limit*s causes performance problems due to accounting overhead # in the kernel. We recommend using cgroups to do container-local accounting. LimitNOFILE=infinity LimitNPROC=infinity LimitCORE=infinity # Comment TasksMax if your systemd version does not support it. # Only systemd 226 and above support this option. TasksMax=infinity # set delegate yes so that systemd does not reset the cgroups of docker containers Delegate=yes # kill only the docker process, not all processes in the cgroup KillMode=process OOMScoreAdjust=-500 [Install] WantedBy=multi-user.target EOF ``` `啟動重要的參數:/usr/bin/dockerd --graph=/data/docker -H fd:// --containerd=/run/containerd/containerd.sock` ### 啟動docker容器 ```bash #重新加載配置文件 systemctl daemon-reload #啟動 systemctl start docker #設置開機啟動 systemctl enable docker.service #查看docker服務狀態 systemctl status docker #查看docker版本 docker -v #查看docker容器里的鏡像 docker images #查看容器數據文件存儲路徑 docker info |grep "Docker Root" ``` ### 鏡像導入 ```bash [root@ncayu docker-images]# docker load -i minio-latest.tar [root@ncayu docker-images]# docker load -i mysql-5.7.tar [root@ncayu docker-images]# docker load -i redis-6.2.3.tar ``` ### docker進程展示 ## 安裝docker-compose1.25.0 ```bash curl -L "https://github.com/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose # 添加可執行權限 sudo chmod +x /usr/local/bin/docker-compose # 添加快捷啟動連接 sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose # 測試安裝結果 docker-compose --version ```
                  <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>

                              哎呀哎呀视频在线观看