日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Docker:尝试篇

發(fā)布時(shí)間:2025/3/15 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Docker:尝试篇 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

寫在前面

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

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

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

安裝

安裝環(huán)境:

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

安裝記錄

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

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

OK,純凈系統(tǒng)安裝,沒報(bào)任何令人不愉快的錯誤,安裝完成。

驗(yàn)證

查看版本:

sudo docker version

輸出結(jié)果:

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

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

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

運(yùn)行一個例子

sudo docker run hello-world

輸出結(jié)果:

注意其中的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/

權(quán)限設(shè)置

可能(肯定)出現(xiàn)的錯誤

在使用非root用戶登陸的時(shí)候,如果命令不加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引起的權(quán)限的問題。

去掉sudo

方法是,新建一個docker用戶組,然后把現(xiàn)有用戶添加進(jìn)該組即可

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

然后再執(zhí)行命令就不會報(bào)錯了。

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

轉(zhuǎn)載于:https://www.cnblogs.com/dantezhao/p/5365166.html

總結(jié)

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

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。