Não foi possível encontrar a unidade docker.service


14

É necessário conectar as interfaces? Ou isso pode ser um problema de firewall ?

thufir@dur:~$ sudo snap install docker
docker 17.06.1-ce from 'docker-inc' installed
thufir@dur:~$ sudo service docker start
Failed to start docker.service: Unit docker.service not found.
thufir@dur:~$ sudo systemctl status docker
Unit docker.service could not be found.
thufir@dur:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 17.10
Release:    17.10
Codename:   artful
thufir@dur:~$ snap list
Name         Version     Rev   Developer   Notes
core         16-2.29.3   3440  canonical   core
docker       17.06.1-ce  171   docker-inc  -
hello-world  6.3         27    canonical   -
ubuntu-make  master      116   didrocks    classic
thufir@dur:~$ apt-cache policy snapd
snapd:
  Installed: 2.28.5+17.10
  Candidate: 2.28.5+17.10
  Version table:
 *** 2.28.5+17.10 500
        500 http://ca.archive.ubuntu.com/ubuntu artful/main amd64 Packages
        100 /var/lib/dpkg/status

Embora eu possa ver o docker info:

thufir@dur:~$ sudo docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 17.06.1-ce
Storage Driver: aufs
 Root Dir: /var/snap/docker/common/var-lib-docker/aufs
 Backing Filesystem: extfs
 Dirs: 0
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version:  (expected: 6e23458c129b551d5c9871e5174f6b1b7f6d1170)
runc version: N/A (expected: 810190ceaa507aa2727d7ae6f4790c76ec150bd2)
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.13.0-16-generic
Operating System: Ubuntu Core 16
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.753GiB
Name: dur
ID: GI3J:YZMK:NZPT:ZPYN:GSU7:VZAQ:7C7J:ZUWM:JMY4:TFLE:EZCZ:UBPI
Docker Root Dir: /var/snap/docker/common/var-lib-docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 16
 Goroutines: 25
 System Time: 2017-11-19T00:13:00.413332334-08:00
 EventsListeners: 0
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support

Não está claro por que não consigo iniciar o dockerdaemon. Poderia estar relacionado a PAM?

thufir@dur:~$ sudo journalctl -xe
Nov 19 00:13:00 dur audit[7092]: AVC apparmor="DENIED" operation="capable" profile="snap.docker.docker" pid=7092 comm="docker-wrapper" capability=1  capname="dac_override"
Nov 19 00:13:00 dur kernel: audit: type=1400 audit(1511079180.396:115): apparmor="DENIED" operation="capable" profile="snap.docker.docker" pid=7092 comm="docker-wrapper" capability=2  capname="dac_rea
Nov 19 00:13:00 dur kernel: audit: type=1400 audit(1511079180.396:116): apparmor="DENIED" operation="capable" profile="snap.docker.docker" pid=7092 comm="docker-wrapper" capability=1  capname="dac_ove
Nov 19 00:13:00 dur docker.dockerd[6294]: time="2017-11-19T00:13:00.411163152-08:00" level=debug msg="Calling GET /_ping"
Nov 19 00:13:00 dur docker.dockerd[6294]: time="2017-11-19T00:13:00.411699012-08:00" level=debug msg="Calling GET /v1.30/info"
Nov 19 00:13:00 dur docker.dockerd[6294]: time="2017-11-19T00:13:00.418078922-08:00" level=warning msg="failed to retrieve docker-runc version: unknown output format: runc version 1.0.0-rc3\nspec: 1.0
Nov 19 00:13:00 dur sudo[7091]: pam_unix(sudo:session): session closed for user root
Nov 19 00:13:22 dur org.gnome.Shell.desktop[2602]: Window manager warning: last_user_time (2275014) is greater than comparison timestamp (2275008).  This most likely represents a buggy client sending 
Nov 19 00:13:22 dur org.gnome.Shell.desktop[2602]: Window manager warning: 0x2800010 (Edit - Ask) appears to be one of the offending windows with a timestamp of 2275014.  Working around...
Nov 19 00:13:22 dur org.gnome.Shell.desktop[2602]: Window manager warning: last_user_time (2275045) is greater than comparison timestamp (2275039).  This most likely represents a buggy client sending 
Nov 19 00:13:22 dur org.gnome.Shell.desktop[2602]: Window manager warning: 0x2800010 (Edit - Ask) appears to be one of the offending windows with a timestamp of 2275045.  Working around...
Nov 19 00:13:22 dur org.gnome.Shell.desktop[2602]: Window manager warning: last_user_time (2275075) is greater than comparison timestamp (2275070).  This most likely represents a buggy client sending 
Nov 19 00:13:22 dur org.gnome.Shell.desktop[2602]: Window manager warning: 0x2800010 (Edit - Ask) appears to be one of the offending windows with a timestamp of 2275075.  Working around...
Nov 19 00:13:22 dur org.gnome.Shell.desktop[2602]: Window manager warning: last_user_time (2275105) is greater than comparison timestamp (2275100).  This most likely represents a buggy client sending 
Nov 19 00:13:22 dur org.gnome.Shell.desktop[2602]: Window manager warning: 0x2800010 (Edit - Ask) appears to be one of the offending windows with a timestamp of 2275105.  Working around...
Nov 19 00:13:22 dur org.gnome.Shell.desktop[2602]: Window manager warning: last_user_time (2275166) is greater than comparison timestamp (2275162).  This most likely represents a buggy client sending 
Nov 19 00:13:22 dur org.gnome.Shell.desktop[2602]: Window manager warning: 0x2800010 (Edit - Ask) appears to be one of the offending windows with a timestamp of 2275166.  Working around...
Nov 19 00:13:22 dur org.gnome.Shell.desktop[2602]: Window manager warning: last_user_time (2275196) is greater than comparison timestamp (2275193).  This most likely represents a buggy client sending 
Nov 19 00:13:22 dur org.gnome.Shell.desktop[2602]: Window manager warning: 0x2800010 (Edit - Ask) appears to be one of the offending windows with a timestamp of 2275196.  Working around...
Nov 19 00:13:22 dur org.gnome.Shell.desktop[2602]: Window manager warning: last_user_time (2275226) is greater than comparison timestamp (2275223).  This most likely represents a buggy client sending 
Nov 19 00:13:22 dur org.gnome.Shell.desktop[2602]: Window manager warning: 0x2800010 (Edit - Ask) appears to be one of the offending windows with a timestamp of 2275226.  Working around...
Nov 19 00:13:22 dur org.gnome.Shell.desktop[2602]: Window manager warning: last_user_time (2275256) is greater than comparison timestamp (2275254).  This most likely represents a buggy client sending 
Nov 19 00:13:22 dur org.gnome.Shell.desktop[2602]: Window manager warning: 0x2800010 (Edit - Ask) appears to be one of the offending windows with a timestamp of 2275256.  Working around...
Nov 19 00:13:22 dur org.gnome.Shell.desktop[2602]: Window manager warning: last_user_time (2275287) is greater than comparison timestamp (2275284).  This most likely represents a buggy client sending 
Nov 19 00:13:22 dur org.gnome.Shell.desktop[2602]: Window manager warning: 0x2800010 (Edit - Ask) appears to be one of the offending windows with a timestamp of 2275287.  Working around...
Nov 19 00:13:22 dur org.gnome.Shell.desktop[2602]: Window manager warning: last_user_time (2275347) is greater than comparison timestamp (2275345).  This most likely represents a buggy client sending 
Nov 19 00:13:22 dur org.gnome.Shell.desktop[2602]: Window manager warning: 0x2800010 (Edit - Ask) appears to be one of the offending windows with a timestamp of 2275347.  Working around...
Nov 19 00:13:22 dur org.gnome.Shell.desktop[2602]: Window manager warning: last_user_time (2275377) is greater than comparison timestamp (2275376).  This most likely represents a buggy client sending 
Nov 19 00:13:22 dur org.gnome.Shell.desktop[2602]: Window manager warning: 0x2800010 (Edit - Ask) appears to be one of the offending windows with a timestamp of 2275377.  Working around...
Nov 19 00:13:22 dur org.gnome.Shell.desktop[2602]: Window manager warning: last_user_time (2275407) is greater than comparison timestamp (2275406).  This most likely represents a buggy client sending 
Nov 19 00:13:22 dur org.gnome.Shell.desktop[2602]: Window manager warning: 0x2800010 (Edit - Ask) appears to be one of the offending windows with a timestamp of 2275407.  Working around...
Nov 19 00:14:42 dur org.gnome.Shell.desktop[2602]: Window manager warning: last_user_time (2355828) is greater than comparison timestamp (2355826).  This most likely represents a buggy client sending 
Nov 19 00:14:42 dur org.gnome.Shell.desktop[2602]: Window manager warning: 0x2800010 (Edit - Ask) appears to be one of the offending windows with a timestamp of 2355828.  Working around...
Nov 19 00:14:43 dur org.gnome.Shell.desktop[2602]: Window manager warning: last_user_time (2355858) is greater than comparison timestamp (2355856).  This most likely represents a buggy client sending 
Nov 19 00:14:43 dur org.gnome.Shell.desktop[2602]: Window manager warning: 0x2800010 (Edit - Ask) appears to be one of the offending windows with a timestamp of 2355858.  Working around...
Nov 19 00:14:43 dur org.gnome.Shell.desktop[2602]: Window manager warning: last_user_time (2355888) is greater than comparison timestamp (2355886).  This most likely represents a buggy client sending 
Nov 19 00:14:43 dur org.gnome.Shell.desktop[2602]: Window manager warning: 0x2800010 (Edit - Ask) appears to be one of the offending windows with a timestamp of 2355888.  Working around...
Nov 19 00:17:01 dur CRON[7177]: pam_unix(cron:session): session opened for user root by (uid=0)
Nov 19 00:17:01 dur CRON[7178]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Nov 19 00:17:01 dur CRON[7177]: pam_unix(cron:session): session closed for user root
Nov 19 00:19:38 dur org.gnome.Shell.desktop[2602]: Window manager warning: last_user_time (2650978) is greater than comparison timestamp (2650977).  This most likely represents a buggy client sending 
Nov 19 00:19:38 dur org.gnome.Shell.desktop[2602]: Window manager warning: 0x2800010 (Error when) appears to be one of the offending windows with a timestamp of 2650978.  Working around...
Nov 19 00:19:38 dur org.gnome.Shell.desktop[2602]: Window manager warning: last_user_time (2651008) is greater than comparison timestamp (2651007).  This most likely represents a buggy client sending 
Nov 19 00:19:38 dur org.gnome.Shell.desktop[2602]: Window manager warning: 0x2800010 (Error when) appears to be one of the offending windows with a timestamp of 2651008.  Working around...
Nov 19 00:19:38 dur org.gnome.Shell.desktop[2602]: Window manager warning: last_user_time (2651069) is greater than comparison timestamp (2651068).  This most likely represents a buggy client sending 
Nov 19 00:19:38 dur org.gnome.Shell.desktop[2602]: Window manager warning: 0x2800010 (Error when) appears to be one of the offending windows with a timestamp of 2651069.  Working around...
Nov 19 00:19:38 dur org.gnome.Shell.desktop[2602]: Window manager warning: last_user_time (2651099) is greater than comparison timestamp (2651098).  This most likely represents a buggy client sending 
Nov 19 00:19:38 dur org.gnome.Shell.desktop[2602]: Window manager warning: 0x2800010 (Error when) appears to be one of the offending windows with a timestamp of 2651099.  Working around...
Nov 19 00:22:46 dur sudo[7271]:   thufir : TTY=pts/0 ; PWD=/home/thufir ; USER=root ; COMMAND=/bin/journalctl -xe
Nov 19 00:22:46 dur sudo[7271]: pam_unix(sudo:session): session opened for user root by (uid=0)
Nov 19 00:22:50 dur sudo[7271]: pam_unix(sudo:session): session closed for user root
Nov 19 00:23:03 dur sudo[7277]:   thufir : TTY=pts/0 ; PWD=/home/thufir ; USER=root ; COMMAND=/snap/bin/docker info
Nov 19 00:23:03 dur sudo[7277]: pam_unix(sudo:session): session opened for user root by (uid=0)
Nov 19 00:23:03 dur audit[7278]: AVC apparmor="DENIED" operation="capable" profile="/snap/core/3440/usr/lib/snapd/snap-confine" pid=7278 comm="snap-confine" capability=2  capname="dac_read_search"
Nov 19 00:23:03 dur kernel: audit: type=1400 audit(1511079783.047:117): apparmor="DENIED" operation="capable" profile="/snap/core/3440/usr/lib/snapd/snap-confine" pid=7278 comm="snap-confine" capabili
Nov 19 00:23:03 dur docker.dockerd[6294]: time="2017-11-19T00:23:03.083250449-08:00" level=debug msg="Calling GET /_ping"
Nov 19 00:23:03 dur docker.dockerd[6294]: time="2017-11-19T00:23:03.083660889-08:00" level=debug msg="Calling GET /v1.30/info"
Nov 19 00:23:03 dur docker.dockerd[6294]: time="2017-11-19T00:23:03.089157810-08:00" level=warning msg="failed to retrieve docker-runc version: unknown output format: runc version 1.0.0-rc3\nspec: 1.0
Nov 19 00:23:03 dur sudo[7277]: pam_unix(sudo:session): session closed for user root
Nov 19 00:23:18 dur sudo[7305]:   thufir : TTY=pts/0 ; PWD=/home/thufir ; USER=root ; COMMAND=/usr/sbin/service docker status
Nov 19 00:23:18 dur sudo[7305]: pam_unix(sudo:session): session opened for user root by (uid=0)
Nov 19 00:23:18 dur sudo[7305]: pam_unix(sudo:session): session closed for user root
Nov 19 00:23:23 dur sudo[7312]:   thufir : TTY=pts/0 ; PWD=/home/thufir ; USER=root ; COMMAND=/usr/sbin/service docker start
Nov 19 00:23:23 dur sudo[7312]: pam_unix(sudo:session): session opened for user root by (uid=0)
Nov 19 00:23:23 dur sudo[7312]: pam_unix(sudo:session): session closed for user root
Nov 19 00:23:27 dur sudo[7345]:   thufir : TTY=pts/0 ; PWD=/home/thufir ; USER=root ; COMMAND=/bin/journalctl -xe
Nov 19 00:23:27 dur sudo[7345]: pam_unix(sudo:session): session opened for user root by (uid=0)
Nov 19 00:23:31 dur sudo[7345]: pam_unix(sudo:session): session closed for user root
Nov 19 00:24:07 dur gnome-terminal-[5450]: Allocating size to GtkBox 0x55b035a10710 without calling gtk_widget_get_preferred_width/height(). How does the code know the size to allocate?
Nov 19 00:24:14 dur sudo[7360]:   thufir : TTY=pts/0 ; PWD=/home/thufir ; USER=root ; COMMAND=/bin/journalctl -xe
Nov 19 00:24:14 dur sudo[7360]: pam_unix(sudo:session): session opened for user root by (uid=0)
lines 1210-1280/1280 (END)


11
@dessert essas são as instruções do docker - não do snap. Não duvido que as instruções funcionem bem. Como o título sugere, ou melhor, afirma, usando snap. Exatamente como a pergunta vinculada.
Thufir

Respostas:


23

Aqui está a maneira correta de usar o snap:

ubuntu@ip-172-31-14-19:~$ 
ubuntu@ip-172-31-14-19:~$ docker.help
Docker snap: Docker Linux container runtime.

Due to the confinement issues on snappy, it requires some manual setup to make docker-snap works on your machine.
We'll take you through the steps needed to set up docker snap work for you on ubuntu core and ubuntu classic.

On Ubuntu classic, before installing the docker snap,
please run the following command to add the login user into docker group.
    sudo addgroup --system docker
    sudo adduser $USER docker
    newgrp docker

On Ubuntu Core 16, after installing the docker snap from store,
you need to connect the home interface as it's not auto-connected by default.
    sudo snap connect docker:home :home

Then have fun with docker in snappy.

ubuntu@ip-172-31-14-19:~$ 
ubuntu@ip-172-31-14-19:~$ 
ubuntu@ip-172-31-14-19:~$ 
ubuntu@ip-172-31-14-19:~$ 
ubuntu@ip-172-31-14-19:~$ sudo 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.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://cloud.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/

ubuntu@ip-172-31-14-19:~$ 
ubuntu@ip-172-31-14-19:~$ sudo docker run -it ubuntu bash
root@7d52680ee4bb:/# 
root@7d52680ee4bb:/# exit
exit
ubuntu@ip-172-31-14-19:~$ 
ubuntu@ip-172-31-14-19:~$ sudo snap services
Snap    Service  Startup  Current
docker  dockerd  enabled  active
ubuntu@ip-172-31-14-19:~$ 
ubuntu@ip-172-31-14-19:~$ sudo snap services docker
Snap    Service  Startup  Current
docker  dockerd  enabled  active
ubuntu@ip-172-31-14-19:~$ 

o acima é de AWS, mas funciona tão bem quanto o Ubuntu padrão.

e para iniciar o serviço:

thufir@dur:~$ 
thufir@dur:~$ sudo snap services
Snap    Service  Startup  Current
docker  dockerd  enabled  inactive
thufir@dur:~$ 
thufir@dur:~$ sudo snap start docker
Started.
thufir@dur:~$ 
thufir@dur:~$ sudo snap services
Snap    Service  Startup  Current
docker  dockerd  enabled  inactive
thufir@dur:~$ 
Ao utilizar nosso site, você reconhece que leu e compreendeu nossa Política de Cookies e nossa Política de Privacidade.
Licensed under cc by-sa 3.0 with attribution required.