日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

Docker:尝试篇

發布時間:2025/3/15 43 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Docker:尝试篇 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

寫在前面

學習Docker,官方文檔必不可少,官網提供了比較好的文檔支持以及一個交互型教程的幫助,建議最初的時候先以官網為主,出問題后再找一些博客和資料幫助解決。

  • 安裝教程:https://docs.docker.com/installation/ubuntulinux/
  • 使用教程:https://docs.docker.com/userguide/
  • 交互教程:https://www.docker.com/gettingstarted

首先強烈建議玩一遍官方的一個交互式命令行入門教程。甚至要多玩幾遍,加深印象。

安裝

安裝環境:

  • OS:Ubuntu14.04(筆記本)
  • Docker:1.6.2

安裝記錄

Ubuntu14.04安裝Docker省卻了更新內核等各種操作,可直接安裝,按照官網的方式即可,只有一步,網上一些博客的安裝方式和官網的方式是不一樣的。自己選擇。

wget -qO- https://get.docker.com/ | sh

OK,純凈系統安裝,沒報任何令人不愉快的錯誤,安裝完成。

驗證

查看版本:

sudo docker version

輸出結果:

Client version: 1.6.2 Client API version: 1.18 Go version (client): go1.4.2 Git commit (client): 7c8fca2 OS/Arch (client): linux/amd64 Server version: 1.6.2 Server API version: 1.18 Go version (server): go1.4.2 Git commit (server): 7c8fca2 OS/Arch (server): linux/amd64

查看信息

sudo docker info

輸出信息:
(我是安裝成功后寫的文檔,所以會有一些多余的內容,初次使用應該不會出現。另:無形中暴露了自己的機器信息……)

Containers: 12 Images: 25 Storage Driver: aufsRoot Dir: /var/lib/docker/aufsBacking Filesystem: extfsDirs: 49Dirperm1 Supported: false Execution Driver: native-0.2 Kernel Version: 3.13.0-32-generic Operating System: Ubuntu 14.04.1 LTS CPUs: 8 Total Memory: 7.362 GiB Name: prairie ID: RID2:KUDU:ZGN7:S2EC:WMHQ:4OK2:7MUU:J4WZ:X35Z:YJW2:A3CF:F22X Username: ×××××× Registry: [https://index.docker.io/v1/] WARNING: No swap limit support

運行一個例子

sudo docker run hello-world

輸出結果:

注意其中的This message shows that your installation appears to be working correctly. 證明docker安裝成功了。

Hello from Docker. This message shows that your installation appears to be working correctly.To generate this message, Docker took the following steps:1. The Docker client contacted the Docker daemon.2. The Docker daemon pulled the "hello-world" image from the Docker Hub.(Assuming it was not already locally available.)3. The Docker daemon created a new container from that image which runs theexecutable that produces the output you are currently reading.4. The Docker daemon streamed that output to the Docker client, which sent itto your terminal.To try something more ambitious, you can run an Ubuntu container with:$ docker run -it ubuntu bashFor more examples and ideas, visit:http://docs.docker.com/userguide/

權限設置

可能(肯定)出現的錯誤

在使用非root用戶登陸的時候,如果命令不加sudo,會有如下錯誤:

test@prairie:/root$ docker info FATA[0000] Get http:///var/run/docker.sock/v1.18/info: dial unix /var/run/docker.sock: permission denied. Are you trying to connect to a TLS-enabled daemon without TLS?

這是沒有加sudo引起的權限的問題。

去掉sudo

方法是,新建一個docker用戶組,然后把現有用戶添加進該組即可

sudo usermod -aG docker zhao(假設以zhao用戶登陸)

然后再執行命令就不會報錯了。

zhao@prairie:~$ docker run hello-world Hello from Docker. This message shows that your installation appears to be working correctly.To generate this message, Docker took the following steps:1. The Docker client contacted the Docker daemon.2. The Docker daemon pulled the "hello-world" image from the Docker Hub.(Assuming it was not already locally available.)3. The Docker daemon created a new container from that image which runs theexecutable that produces the output you are currently reading.4. The Docker daemon streamed that output to the Docker client, which sent itto your terminal.To try something more ambitious, you can run an Ubuntu container with:$ docker run -it ubuntu bashFor more examples and ideas, visit:http://docs.docker.com/userguide/

文章來源:http://blog.csdn.net/zhaodedong

轉載于:https://www.cnblogs.com/dantezhao/p/5365166.html

總結

以上是生活随笔為你收集整理的Docker:尝试篇的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。