Eu tentei atualizar o docker e recebi um erro, então fiz uma reinstalação. No entanto, o problema persiste. A pasta que ele não identifica de fato não existe. O que posso fazer para corrigir esse problema?
É claro que eu poderia simplesmente criar esse diretório e esperar que não fosse um sinal de algo terrivelmente quebrado que me assombraria mais tarde. Mas eu gostaria de ter a opinião de alguém que sabe mais do que eu.
generic@motorbrot:~$ sudo apt-get install docker.io
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
aufs-tools btrfs-progs debootstrap docker-doc rinse zfs-fuse | zfsutils
The following NEW packages will be installed:
docker.io
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/36.9 MB of archives.
After this operation, 192 MB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously unselected package docker.io.
(Reading database ... 539898 files and directories currently installed.)
Preparing to unpack .../docker.io_20.10.2-0ubuntu1~18.04.2_amd64.deb ...
Unpacking docker.io (20.10.2-0ubuntu1~18.04.2) ...
Setting up docker.io (20.10.2-0ubuntu1~18.04.2) ...
mv: cannot stat '/var/lib/docker': No such file or directory
dpkg: error processing package docker.io (--configure):
installed docker.io package post-installation script subprocess returned error exit status 1
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Errors were encountered while processing:
docker.io
E: Sub-process /usr/bin/dpkg returned an error code (1)
O Docker parece estar instalado:
generic@motorbrot:~$ which docker
/usr/bin/docker
generic@motorbrot:~$ docker --version
Docker version 20.10.2, build 20.10.2-0ubuntu1~18.04.2
Mas quando eu executo sudo apt upgrade
ele mostra como "Não totalmente instalado ou removido".
generic@motorbrot:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up docker.io (20.10.2-0ubuntu1~18.04.2) ...
mv: cannot stat '/var/lib/docker': No such file or directory
dpkg: error processing package docker.io (--configure):
installed docker.io package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
docker.io
E: Sub-process /usr/bin/dpkg returned an error code (1)
generic@motorbrot:~/algolab$ dpkg -s docker.io | grep Status
Status: install ok half-configured
Sistema
Estou no Ubuntu 18.04
$ uname -a
Linux motorbrot 5.4.0-72-generic #80~18.04.1-Ubuntu SMP Mon Apr 12 23:26:25 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Tentando usar o docker
mas não consigo iniciar o daemon. diz que está "mascarado".
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
generic@motorbrot:~/algolab$ sudo systemctl docker start
Unknown operation docker.
generic@motorbrot:~/algolab$ sudo service docker start
Failed to start docker.service: Unit docker.service is masked.
generic@motorbrot:~/algolab$ sudo systemctl unmask docker
Removed /etc/systemd/system/docker.service.
generic@motorbrot:~/algolab$ sudo systemctl start docker
Failed to start docker.service: Unit docker.socket is masked.
Criando diretório/var/lib/docker
Eu tentei criar esse diretório que não conseguiu stat (depois de fazer um instantâneo zfs para que eu pudesse reverter no pior caso). Agora está reclamando que docker.migrating/docker
não está vazio.
generic@motorbrot:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up docker.io (20.10.2-0ubuntu1~18.04.2) ...
mv: cannot move '/var/lib/docker' to '/var/lib/docker.migrating/docker': Directory not empty
dpkg: error processing package docker.io (--configure):
installed docker.io package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
docker.io
E: Sub-process /usr/bin/dpkg returned an error code (1)
E mesmo se eu remover esse diretório, recebo problemas:
generic@motorbrot:~$ sudo rm -r /var/lib/docker.migrating/docker
generic@motorbrot:~$ sudo mkdir /var/lib/docker
generic@motorbrot:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up docker.io (20.10.2-0ubuntu1~18.04.2) ...
mv: target '/var/lib/docker/' is not a directory
dpkg: error processing package docker.io (--configure):
installed docker.io package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
docker.io
E: Sub-process /usr/bin/dpkg returned an error code (1)
O script pós-instalação
Ele está localizado em /var/lib/dpkg/info/docker.io.postinst
de acordo com esta resposta , e me parece que ele exclui o diretório mesmo que eu o crie com antecedência, depois reclama que ele não existe.
Uma rápida olhada mostra que ele faz um tratamento especial para o ZFS, então devo salientar que estou realmente executando o ZFS na raiz.
Apt Purgar
Estou indo um pouco nuclear agora, raramente uso o docker de qualquer maneira. Eu removi todos os conjuntos de dados do docker que estavam me incomodando de zfs list
qualquer maneira:
for dataset in $(zfs list | grep legacy | cut -f1); do zfs destroy -R "$dataset" || true ; done
e também fez uma limpeza
$ sudo apt purge docker.io
generic@motorbrot:~$ sudo apt purge docker.io
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
bridge-utils cgroupfs-mount containerd pigz runc ubuntu-fan
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
docker.io*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 192 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 540125 files and directories currently installed.)
Removing docker.io (20.10.2-0ubuntu1~18.04.2) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
(Reading database ... 539920 files and directories currently installed.)
Purging configuration files for docker.io (20.10.2-0ubuntu1~18.04.2) ...
dpkg: warning: while removing docker.io, directory '/etc/docker' not empty so not removed
Resta um arquivo/etc/docker/key.json
Reinstale novamente, obtenha um novo problema:
generic@motorbrot:~$ sudo apt install docker.io
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
aufs-tools btrfs-progs debootstrap docker-doc rinse zfs-fuse | zfsutils
The following NEW packages will be installed:
docker.io
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/36.9 MB of archives.
After this operation, 192 MB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously unselected package docker.io.
(Reading database ... 539920 files and directories currently installed.)
Preparing to unpack .../docker.io_20.10.2-0ubuntu1~18.04.2_amd64.deb ...
Unpacking docker.io (20.10.2-0ubuntu1~18.04.2) ...
Setting up docker.io (20.10.2-0ubuntu1~18.04.2) ...
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service.
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket.
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.
invoke-rc.d: initscript docker, action "start" failed.
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Fri 2021-04-23 14:31:06 CEST; 3ms ago
Docs: https://docs.docker.com
Process: 32306 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 32306 (code=exited, status=1/FAILURE)
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
generic@motorbrot:~$ sudo systemctl restart docker
Eu brinquei descuidadamente com isso, e agora o docker está funcionando novamente para mim! Cuidado que minha abordagem foi bastante nuclear!
sudo apt remove docker.io
sudo apt purge docker.io
/var/lib/docker
ou/var/lib/docker.migating
ainda existam, remova-oszfs list | grep legacy
mostre quaisquer conjuntos de dados docker, remova-os todos comfor dataset in $(zfs list | grep legacy | cut -f1); do zfs destroy -R "$dataset" || true ; done
Novamente, este é um comando arriscado que também pode destruir outras coisas! Certifique-se de que você não se importa com perda de dados ou sabe o que está fazendo. Eu nem sei se esse passo foi necessário.sudo apt install docker.io
--> Obter um errosudo systemctl restart docker
Agora está funcionando novamente para mim.