when I install docker everything works properly. But if i reboot my pc and try to use docker to build a Dockerfile i always get a bug when executing the command apt-get install:
...
#0 14.29 Setting up python3.10-minimal (3.10.6-1~22.04.2ubuntu1.1) ...
#0 14.73 [Errno 13] Permission denied: '/usr/lib/python3.10/__pycache__/__future__.cpython-310.pyc.140279856093696'dpkg: error processing package python3.10-minimal (--configure):
#0 14.73 installed python3.10-minimal package post-installation script subprocess returned error exit status 1
#0 14.84 Errors were encountered while processing:
#0 14.84 python3.10-minimal
#0 14.89 E: Sub-process /usr/bin/dpkg returned an error code (1)
...
the only way to solve the permission denied error is to uninstall Docker and install it again.
Of course when I reboot the pc after the newer installation the loop starts all over again.
the code above is just an excerpt. below is the full error code
=> ERROR [ 2/18] RUN DEBIAN_FRONTEND=noninteractive apt-get update -y && DEBIA 27.3s
------
> [ 2/18] RUN DEBIAN_FRONTEND=noninteractive apt-get update -y && DEBIAN_FRONTEND=noninteractive apt-get install -y curl gnupg lsb-release && curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu jammy main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null && DEBIAN_FRONTEND=noninteractive apt-get update -y && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential cmake git python3-flake8 python3-flake8-blind-except python3-flake8-builtins python3-flake8-class-newline python3-flake8-comprehensions python3-flake8-deprecated python3-flake8-docstrings python3-flake8-import-order python3-flake8-quotes python3-pip python3-pytest python3-pytest-cov python3-pytest-repeat python3-pytest-rerunfailures python3-rosdep2 python3-setuptools locales wget:
#0 7.363 Get:1 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
#0 7.363 Get:2 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
#0 7.801 Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
#0 7.903 Get:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [108 kB]
#0 9.579 Get:5 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [541 kB]
#0 9.710 Get:6 http://archive.ubuntu.com/ubuntu jammy/multiverse amd64 Packages [266 kB]
#0 9.926 Get:7 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages [17.5 MB]
#0 10.46 Get:8 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [938 kB]
#0 10.99 Get:9 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [631 kB]
#0 11.30 Get:10 http://security.ubuntu.com/ubuntu jammy-security/multiverse amd64 Packages [36.3 kB]
#0 13.01 Get:11 http://archive.ubuntu.com/ubuntu jammy/restricted amd64 Packages [164 kB]
#0 13.01 Get:12 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages [1792 kB]
#0 13.20 Get:13 http://archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [545 kB]
#0 13.28 Get:14 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [919 kB]
#0 13.42 Get:15 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1191 kB]
#0 13.60 Get:16 http://archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 Packages [42.2 kB]
#0 13.82 Get:17 http://archive.ubuntu.com/ubuntu jammy-backports/universe amd64 Packages [25.5 kB]
#0 14.05 Get:18 http://archive.ubuntu.com/ubuntu jammy-backports/main amd64 Packages [49.4 kB]
#0 14.24 Fetched 25.2 MB in 7s (3385 kB/s)
#0 14.24 Reading package lists...
#0 15.00 Reading package lists...
#0 15.67 Building dependency tree...
#0 15.78 Reading state information...
#0 15.89 The following additional packages will be installed:
#0 15.89 ca-certificates dirmngr distro-info-data gnupg-l10n gnupg-utils gpg
#0 15.89 gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm libassuan0 libbrotli1
#0 15.89 libcurl4 libexpat1 libksba8 libldap-2.5-0 libldap-common libmpdec3
#0 15.89 libnghttp2-14 libnpth0 libpsl5 libpython3-stdlib libpython3.10-minimal
#0 15.89 libpython3.10-stdlib libreadline8 librtmp1 libsasl2-2 libsasl2-modules
#0 15.89 libsasl2-modules-db libsqlite3-0 libssh-4 media-types openssl
#0 15.89 pinentry-curses publicsuffix python3 python3-minimal python3.10
#0 15.89 python3.10-minimal readline-common
#0 15.89 Suggested packages:
#0 15.89 dbus-user-session libpam-systemd pinentry-gnome3 tor parcimonie xloadimage
#0 15.89 scdaemon libsasl2-modules-gssapi-mit | libsasl2-modules-gssapi-heimdal
#0 15.89 libsasl2-modules-ldap libsasl2-modules-otp libsasl2-modules-sql pinentry-doc
#0 15.89 python3-doc python3-tk python3-venv python3.10-venv python3.10-doc binutils
#0 15.89 binfmt-support readline-doc
#0 15.95 The following NEW packages will be installed:
#0 15.95 ca-certificates curl dirmngr distro-info-data gnupg gnupg-l10n gnupg-utils
#0 15.95 gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm libassuan0
#0 15.95 libbrotli1 libcurl4 libexpat1 libksba8 libldap-2.5-0 libldap-common
#0 15.95 libmpdec3 libnghttp2-14 libnpth0 libpsl5 libpython3-stdlib
#0 15.95 libpython3.10-minimal libpython3.10-stdlib libreadline8 librtmp1 libsasl2-2
#0 15.95 libsasl2-modules libsasl2-modules-db libsqlite3-0 libssh-4 lsb-release
#0 15.95 media-types openssl pinentry-curses publicsuffix python3 python3-minimal
#0 15.95 python3.10 python3.10-minimal readline-common
#0 16.11 0 upgraded, 44 newly installed, 0 to remove and 1 not upgraded.
#0 16.11 Need to get 11.8 MB of archives.
#0 16.11 After this operation, 36.4 MB of additional disk space will be used.
#0 16.11 Get:1 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libpython3.10-minimal amd64 3.10.6-1~22.04.2ubuntu1.1 [810 kB]
#0 16.58 Get:2 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libexpat1 amd64 2.4.7-1ubuntu0.2 [91.0 kB]
#0 16.59 Get:3 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 python3.10-minimal amd64 3.10.6-1~22.04.2ubuntu1.1 [2262 kB]
#0 17.16 Get:4 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 python3-minimal amd64 3.10.6-1~22.04 [24.3 kB]
#0 17.16 Get:5 http://archive.ubuntu.com/ubuntu jammy/main amd64 media-types all 7.0.0 [25.5 kB]
#0 17.16 Get:6 http://archive.ubuntu.com/ubuntu jammy/main amd64 libmpdec3 amd64 2.5.1-2build2 [86.8 kB]
#0 17.17 Get:7 http://archive.ubuntu.com/ubuntu jammy/main amd64 readline-common all 8.1.2-1 [53.5 kB]
#0 17.17 Get:8 http://archive.ubuntu.com/ubuntu jammy/main amd64 libreadline8 amd64 8.1.2-1 [153 kB]
#0 17.20 Get:9 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libsqlite3-0 amd64 3.37.2-2ubuntu0.1 [641 kB]
#0 17.29 Get:10 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libpython3.10-stdlib amd64 3.10.6-1~22.04.2ubuntu1.1 [1832 kB]
#0 17.62 Get:11 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 python3.10 amd64 3.10.6-1~22.04.2ubuntu1.1 [497 kB]
#0 17.93 Get:12 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libpython3-stdlib amd64 3.10.6-1~22.04 [6910 B]
#0 17.97 Get:13 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 python3 amd64 3.10.6-1~22.04 [22.8 kB]
#0 18.01 Get:14 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 openssl amd64 3.0.2-0ubuntu1.10 [1183 kB]
#0 18.43 Get:15 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 ca-certificates all 20230311ubuntu0.22.04.1 [155 kB]
#0 18.59 Get:16 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 distro-info-data all 0.52ubuntu0.4 [4986 B]
#0 18.59 Get:17 http://archive.ubuntu.com/ubuntu jammy/main amd64 lsb-release all 11.1.0ubuntu4 [10.8 kB]
#0 18.59 Get:18 http://archive.ubuntu.com/ubuntu jammy/main amd64 libnghttp2-14 amd64 1.43.0-1build3 [76.3 kB]
#0 18.59 Get:19 http://archive.ubuntu.com/ubuntu jammy/main amd64 libpsl5 amd64 0.21.0-1.2build2 [58.4 kB]
#0 18.59 Get:20 http://archive.ubuntu.com/ubuntu jammy/main amd64 publicsuffix all 20211207.1025-1 [129 kB]
#0 18.60 Get:21 http://archive.ubuntu.com/ubuntu jammy/main amd64 libbrotli1 amd64 1.0.9-2build6 [315 kB]
#0 18.61 Get:22 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libsasl2-modules-db amd64 2.1.27+dfsg2-3ubuntu1.2 [20.5 kB]
#0 18.92 Get:23 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libsasl2-2 amd64 2.1.27+dfsg2-3ubuntu1.2 [53.8 kB]
#0 19.37 Get:24 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libldap-2.5-0 amd64 2.5.14+dfsg-0ubuntu0.22.04.2 [183 kB]
#0 19.77 Get:25 http://archive.ubuntu.com/ubuntu jammy/main amd64 librtmp1 amd64 2.4+20151223.gitfa8646d.1-2build4 [58.2 kB]
#0 19.96 Get:26 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libssh-4 amd64 0.9.6-2ubuntu0.22.04.1 [185 kB]
#0 19.96 Get:27 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libcurl4 amd64 7.81.0-1ubuntu1.10 [290 kB]
#0 20.14 Get:28 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 curl amd64 7.81.0-1ubuntu1.10 [194 kB]
#0 20.31 Get:29 http://archive.ubuntu.com/ubuntu jammy/main amd64 libassuan0 amd64 2.5.5-1build1 [38.2 kB]
#0 20.31 Get:30 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 gpgconf amd64 2.2.27-3ubuntu2.1 [94.2 kB]
#0 20.31 Get:31 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libksba8 amd64 1.6.0-2ubuntu0.2 [119 kB]
#0 20.32 Get:32 http://archive.ubuntu.com/ubuntu jammy/main amd64 libnpth0 amd64 1.6-3build2 [8664 B]
#0 20.32 Get:33 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 dirmngr amd64 2.2.27-3ubuntu2.1 [293 kB]
#0 20.75 Get:34 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 gnupg-l10n all 2.2.27-3ubuntu2.1 [54.4 kB]
#0 21.33 Get:35 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 gnupg-utils amd64 2.2.27-3ubuntu2.1 [308 kB]
#0 21.82 Get:36 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 gpg amd64 2.2.27-3ubuntu2.1 [519 kB]
#0 22.15 Get:37 http://archive.ubuntu.com/ubuntu jammy/main amd64 pinentry-curses amd64 1.1.1-1build2 [34.4 kB]
#0 22.15 Get:38 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 gpg-agent amd64 2.2.27-3ubuntu2.1 [209 kB]
#0 22.19 Get:39 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 gpg-wks-client amd64 2.2.27-3ubuntu2.1 [62.7 kB]
#0 22.20 Get:40 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 gpg-wks-server amd64 2.2.27-3ubuntu2.1 [57.5 kB]
#0 22.22 Get:41 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 gpgsm amd64 2.2.27-3ubuntu2.1 [197 kB]
#0 22.39 Get:42 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 gnupg all 2.2.27-3ubuntu2.1 [315 kB]
#0 22.40 Get:43 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libldap-common all 2.5.14+dfsg-0ubuntu0.22.04.2 [15.8 kB]
#0 22.41 Get:44 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libsasl2-modules amd64 2.1.27+dfsg2-3ubuntu1.2 [68.8 kB]
#0 23.38 debconf: delaying package configuration, since apt-utils is not installed
#0 23.50 Fetched 11.8 MB in 6s (1830 kB/s)
#0 23.87 Selecting previously unselected package libpython3.10-minimal:amd64.
(Reading database ... 4395 files and directories currently installed.)
#0 23.93 Preparing to unpack .../libpython3.10-minimal_3.10.6-1~22.04.2ubuntu1.1_amd64.deb ...
#0 23.99 Unpacking libpython3.10-minimal:amd64 (3.10.6-1~22.04.2ubuntu1.1) ...
#0 24.47 Selecting previously unselected package libexpat1:amd64.
#0 24.48 Preparing to unpack .../libexpat1_2.4.7-1ubuntu0.2_amd64.deb ...
#0 24.56 Unpacking libexpat1:amd64 (2.4.7-1ubuntu0.2) ...
#0 24.90 Selecting previously unselected package python3.10-minimal.
#0 24.91 Preparing to unpack .../python3.10-minimal_3.10.6-1~22.04.2ubuntu1.1_amd64.deb ...
#0 24.99 Unpacking python3.10-minimal (3.10.6-1~22.04.2ubuntu1.1) ...
#0 25.47 Setting up libpython3.10-minimal:amd64 (3.10.6-1~22.04.2ubuntu1.1) ...
#0 25.65 Setting up libexpat1:amd64 (2.4.7-1ubuntu0.2) ...
#0 25.79 Setting up python3.10-minimal (3.10.6-1~22.04.2ubuntu1.1) ...
#0 26.36 [Errno 13] Permission denied: '/usr/lib/python3.10/__pycache__/__future__.cpython-310.pyc.139820552526336'dpkg: error processing package python3.10-minimal (--configure):
#0 26.36 installed python3.10-minimal package post-installation script subprocess returned error exit status 1
#0 26.43 Errors were encountered while processing:
#0 26.43 python3.10-minimal
#0 26.46 E: Sub-process /usr/bin/dpkg returned an error code (1)
------
ERROR: failed to solve: executor failed running [/bin/sh -c DEBIAN_FRONTEND=noninteractive apt-get update -y && DEBIAN_FRONTEND=noninteractive apt-get install -y curl gnupg lsb-release && curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu jammy main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null && DEBIAN_FRONTEND=noninteractive apt-get update -y && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential cmake git python3-flake8 python3-flake8-blind-except python3-flake8-builtins python3-flake8-class-newline python3-flake8-comprehensions python3-flake8-deprecated python3-flake8-docstrings python3-flake8-import-order python3-flake8-quotes python3-pip python3-pytest python3-pytest-cov python3-pytest-repeat python3-pytest-rerunfailures python3-rosdep2 python3-setuptools locales wget]: exit code: 100