2015-05-21 15 views
116

Thêm thông tin này để tham khảo cho người khác vì nó đã lưu tôi 10 phút nếu câu trả lời như vậy tồn tại.lệnh docker không tìm thấy ngay cả khi cài đặt với apt-get


tôi đã cố gắng cài đặt Docker sử dụng ubuntu 14.0LTS VirtualBox

sudo apt get install docker

Tuy nhiên, khi tôi cố gắng chạy Docker nó mang lại cho tôi những lỗi sau

The program 'docker' is currently not installed. You can install it by typing: sudo apt-get install docker

Tại sao ubuntu không nhìn thấy docker?

+0

Để tham khảo: https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/#install-docker-ce – ADTC

Trả lời

173

Gói Ubuntu docker thực sự đề cập đến một ứng dụng GUI, chứ không phải công cụ DevOps yêu quý mà chúng tôi đã tìm ra để tìm kiếm.

=== CẬP NHẬT (nhờ @Scott Stensland) ===

Bây giờ bạn chạy cài đặt kịch bản sau đây để có được Docker:

sudo curl -sSL https://get.docker.com/ | sh 

này sẽ chạy một kịch bản mà cài đặt Docker. Lưu ý phần cuối của kịch bản:

If you would like to use Docker as a non-root user, you should now consider 
adding your user to the "docker" group with something like: 

    sudo usermod -aG docker stens 

Remember that you will have to log out and back in for this to take effect! 

Để cập nhật Docker chạy:

sudo apt-get update && apt-get upgrade 

Để biết thêm chi tiết về những gì đang xảy ra, Xem docker install documentation hoặc câu trả lời @Scott Stensland của dưới

= == OBSOLETE ANSWER ===

Thay vì sử dụng docker sử dụng docker.io

tức,

sudo apt-get install docker.io

Sau đây giải thích lý do tại sao nó được đặt tên như thế này: Why install docker on ubuntu should be `sudo apt-get install docker.io`?

+3

'apt-cache search docker' sẽ cho bạn thấy nhiều thứ, trong số đó 'docklet KDE 3/GNOME 2' không phải là những gì bạn tìm kiếm, và' Linux container runtime' tốt hơn là – user2915097

+0

'TL: DR: issue' có nghĩa là gì? – monojohnny

+1

Câu trả lời này đã lỗi thời ... hãy xem câu trả lời khác ở trên –

18

QUAN TRỌNG - trên ubuntu gói docker là một cái gì đó hoàn toàn khác nhau (tránh nó):

apt-cache search ^docker$ 

docker - System tray for KDE3/GNOME2 docklet applications 

LƯU Ý - gói ubuntu docker.io không nhận được cập nhật ates (lỗi thời không được sử dụng)


Thay vì làm điều này: cài đặt phiên bản mới nhất của Docker trên Linux bằng cách thực hiện như sau:

sudo curl -sSL https://get.docker.com/ | sh 
# sudo curl -sSL https://test.docker.com | sh # get dev pipeline version 

đây là một đầu ra tiêu biểu (ubuntu 16 .04)

apparmor is enabled in the kernel and apparmor utils were already installed 
+ sudo -E sh -c apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D 
Executing: /tmp/tmp.rAAGu0P85R/gpg.1.sh --keyserver 
hkp://ha.pool.sks-keyservers.net:80 
--recv-keys 
58118E89F3A912897C070ADBF76221572C52609D 
gpg: requesting key 2C52609D from hkp server ha.pool.sks-keyservers.net 
gpg: key 2C52609D: "Docker Release Tool (releasedocker) <[email protected]>" 1 new signature 
gpg: Total number processed: 1 
gpg:   new signatures: 1 
+ break 
+ sudo -E sh -c apt-key adv -k 58118E89F3A912897C070ADBF76221572C52609D >/dev/null 
+ sudo -E sh -c mkdir -p /etc/apt/sources.list.d 
+ dpkg --print-architecture 
+ sudo -E sh -c echo deb [arch=amd64] https://apt.dockerproject.org/repo ubuntu-xenial main > /etc/apt/sources.list.d/docker.list 
+ sudo -E sh -c sleep 3; apt-get update; apt-get install -y -q docker-engine 
Hit:1 http://repo.steampowered.com/steam precise InRelease 
Hit:2 http://download.virtualbox.org/virtualbox/debian xenial InRelease               
Ign:3 http://dl.google.com/linux/chrome/deb stable InRelease                  
Hit:4 http://dl.google.com/linux/chrome/deb stable Release                   
Hit:5 http://archive.canonical.com/ubuntu xenial InRelease                   
Hit:6 http://mirror.cc.columbia.edu/pub/linux/ubuntu/archive xenial InRelease              
Hit:7 http://mirror.cc.columbia.edu/pub/linux/ubuntu/archive xenial-updates InRelease            
Hit:8 http://ppa.launchpad.net/me-davidsansome/clementine/ubuntu xenial InRelease             
Ign:9 http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.2 InRelease               
Hit:10 http://mirror.cc.columbia.edu/pub/linux/ubuntu/archive xenial-backports InRelease           
Hit:11 http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.2 Release               
Hit:12 http://mirror.cc.columbia.edu/pub/linux/ubuntu/archive xenial-security InRelease           
Hit:14 http://ppa.launchpad.net/numix/ppa/ubuntu xenial InRelease                 
Ign:15 http://linux.dropbox.com/ubuntu wily InRelease                    
Ign:16 http://repo.vivaldi.com/stable/deb stable InRelease                   
Hit:17 http://repo.vivaldi.com/stable/deb stable Release                   
Get:18 http://linux.dropbox.com/ubuntu wily Release [6,596 B]    
Get:19 https://apt.dockerproject.org/repo ubuntu-xenial InRelease [20.6 kB]  
Ign:20 http://packages.amplify.nginx.com/ubuntu xenial InRelease      
Hit:22 http://packages.amplify.nginx.com/ubuntu xenial Release 
Hit:23 https://deb.opera.com/opera-beta stable InRelease 
Hit:26 https://deb.opera.com/opera-developer stable InRelease 
Get:28 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages [1,719 B] 
Hit:29 https://packagecloud.io/slacktechnologies/slack/debian jessie InRelease 
Fetched 28.9 kB in 1s (17.2 kB/s) 
Reading package lists... Done 
W: http://repo.mongodb.org/apt/debian/dists/wheezy/mongodb-org/3.2/Release.gpg: Signature by key 42F3E95A2C4F08279C4960ADD68FA50FEA312927 uses weak digest algorithm (SHA1) 
Reading package lists... 
Building dependency tree... 
Reading state information... 
The following additional packages will be installed: 
    aufs-tools cgroupfs-mount 
The following NEW packages will be installed: 
    aufs-tools cgroupfs-mount docker-engine 
0 upgraded, 3 newly installed, 0 to remove and 17 not upgraded. 
Need to get 14.6 MB of archives. 
After this operation, 73.7 MB of additional disk space will be used. 
Get:1 http://mirror.cc.columbia.edu/pub/linux/ubuntu/archive xenial/universe amd64 aufs-tools amd64 1:3.2+20130722-1.1ubuntu1 [92.9 kB] 
Get:2 http://mirror.cc.columbia.edu/pub/linux/ubuntu/archive xenial/universe amd64 cgroupfs-mount all 1.2 [4,970 B] 
Get:3 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 docker-engine amd64 1.11.2-0~xenial [14.5 MB] 
Fetched 14.6 MB in 7s (2,047 kB/s) 
Selecting previously unselected package aufs-tools. 
(Reading database ... 427978 files and directories currently installed.) 
Preparing to unpack .../aufs-tools_1%3a3.2+20130722-1.1ubuntu1_amd64.deb ... 
Unpacking aufs-tools (1:3.2+20130722-1.1ubuntu1) ... 
Selecting previously unselected package cgroupfs-mount. 
Preparing to unpack .../cgroupfs-mount_1.2_all.deb ... 
Unpacking cgroupfs-mount (1.2) ... 
Selecting previously unselected package docker-engine. 
Preparing to unpack .../docker-engine_1.11.2-0~xenial_amd64.deb ... 
Unpacking docker-engine (1.11.2-0~xenial) ... 
Processing triggers for libc-bin (2.23-0ubuntu3) ... 
Processing triggers for man-db (2.7.5-1) ... 
Processing triggers for ureadahead (0.100.0-19) ... 
Processing triggers for systemd (229-4ubuntu6) ... 
Setting up aufs-tools (1:3.2+20130722-1.1ubuntu1) ... 
Setting up cgroupfs-mount (1.2) ... 
Setting up docker-engine (1.11.2-0~xenial) ... 
Processing triggers for libc-bin (2.23-0ubuntu3) ... 
Processing triggers for systemd (229-4ubuntu6) ... 
Processing triggers for ureadahead (0.100.0-19) ... 
+ sudo -E sh -c docker version 
Client: 
Version:  1.11.2 
API version: 1.23 
Go version: go1.5.4 
Git commit: b9f10c9 
Built:  Wed Jun 1 22:00:43 2016 
OS/Arch:  linux/amd64 

Server: 
Version:  1.11.2 
API version: 1.23 
Go version: go1.5.4 
Git commit: b9f10c9 
Built:  Wed Jun 1 22:00:43 2016 
OS/Arch:  linux/amd64 

If you would like to use Docker as a non-root user, you should now consider 
adding your user to the "docker" group with something like: 

    sudo usermod -aG docker stens 

Remember that you will have to log out and back in for this to take effect! 

Đây là cơ bản trình bày chi tiết cài đặt hướng dẫn mà bạn có thể thấy đi kèm vào kỹ thuật nói trên ... Trên một lót mang đến cho bạn giống như:

https://docs.docker.com/engine/installation/linux/ubuntulinux/

Sau khi cài đặt bạn có thể xem những gói docker nào đã được cài đặt bằng cách phát hành

dpkg -l|grep docker 

ii docker-engine        1.11.2-0~xenial          amd64  Docker: the open-source application container engine 

bây giờ Bản cập nhật Docker sẽ được cài đặt trong tương lai khi yo u hành

sudo apt-get update 
sudo apt-get upgrade 

hãy nhìn vào

ls -latr /etc/apt/sources.list.d/*docker* 
-rw-r--r-- 1 root root 202 Jun 23 10:01 /etc/apt/sources.list.d/docker.list.save 
-rw-r--r-- 1 root root 71 Jul 4 11:32 /etc/apt/sources.list.d/docker.list 


cat /etc/apt/sources.list.d/docker.list 

deb [arch=amd64] https://apt.dockerproject.org/repo ubuntu-xenial main 
5
sudo apt-get install docker 

là một thư viện khác nhau trên ubuntu.

Sử dụng sudo apt-get install docker.io để cài đặt trình kết nối chính xác.

+0

Vì mục đích đầy đủ: https://packages.ubuntu.com/artful/docker 'Khay hệ thống cho các ứng dụng docklet KDE3/GNOME2' –

2

SET UP kho

Đối với Ubuntu 14,04/16,04/16,10/17,04:

sudo add-apt-repository "deb [arch=amd64] \ 
    https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" 

Đối với Ubuntu 17.10:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu zesty stable" 

Thêm chìa khóa GPG chính thức Docker của:

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - 

Sau đó cài đặt

$ sudo apt-get update && sudo apt-get -y install docker-ce 
0

Chạy lệnh Docker của bạn với sudo:

sudo docker <your command> 

Khi documentation nói:

Các Docker daemon liên kết với một ổ cắm Unix thay vì một cổng TCP. Theo mặc định, ổ cắm Unix được sở hữu bởi người dùng root và những người dùng khác chỉ có thể truy cập nó bằng sudo. Docker daemon luôn chạy như người dùng root.

Nếu bạn không muốn sử dụng sudo khi bạn sử dụng lệnh docker, hãy tạo một nhóm Unix có tên là docker và thêm người dùng vào nó. Khi docker daemon bắt đầu, nó làm cho quyền sở hữu của socket Unix được đọc/ghi bởi nhóm docker .

Các vấn đề liên quan