docker image build error
senhao-xu opened this issue · 1 comments
senhao-xu commented
I referenced this Wiki for image construction, but the following error occurred
#sudo docker build -t retspen/webvirtcloud:1 .
[+] Building 64.5s (12/20)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.82kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 365B 0.0s
=> [internal] load metadata for docker.io/phusion/baseimage:jammy-1.0.1 1.6s
=> [ 1/16] FROM docker.io/phusion/baseimage:jammy-1.0.1@sha256:7faf4efcd96870fe090d969703ef8e727cc9de4f465c8442047ffd26f8094e6b 0.0s
=> [internal] load build context 0.5s
=> => transferring context: 38.08MB 0.5s
=> CACHED [ 2/16] RUN echo 'APT::Get::Clean=always;' >> /etc/apt/apt.conf.d/99AutomaticClean 0.0s
=> CACHED [ 3/16] RUN apt-get update -qqy && DEBIAN_FRONTEND=noninteractive apt-get -qyy install --no-install-recommends git python3-venv python3-dev python3-lxml lib 0.0s
=> [ 4/16] COPY . /srv/webvirtcloud 0.2s
=> [ 5/16] RUN chown -R www-data:www-data /srv/webvirtcloud 1.3s
=> [ 6/16] WORKDIR /srv/webvirtcloud 0.0s
=> [ 7/16] RUN python3 -m venv venv && . venv/bin/activate && pip3 install -U pip && pip3 install wheel && pip3 install -r conf/requirements.txt && pip3 cache purge && c 57.2s
=> ERROR [ 8/16] RUN . venv/bin/activate && python3 manage.py makemigrations && python3 manage.py migrate && python3 manage.py collectstatic --noinput && chown -R www-da 3.6s
------
> [ 8/16] RUN . venv/bin/activate && python3 manage.py makemigrations && python3 manage.py migrate && python3 manage.py collectstatic --noinput && chown -R www-data:www-data /srv/webvirtcloud:
#0 0.988 Migrations for 'accounts':
#0 0.988 accounts/migrations/0006_alter_userattributes_id_alter_userinstance_id_and_more.py
#0 0.988 - Alter field id on userattributes
#0 0.988 - Alter field id on userinstance
#0 0.988 - Alter field id on usersshkey
#0 0.988 Migrations for 'computes':
#0 0.988 computes/migrations/0004_alter_compute_id.py
#0 0.988 - Alter field id on compute
#0 0.988 Migrations for 'instances':
#0 0.988 instances/migrations/0012_alter_flavor_id_alter_instance_id.py
#0 0.988 - Alter field id on flavor
#0 0.988 - Alter field id on instance
#0 0.988 Migrations for 'logs':
#0 0.988 logs/migrations/0004_alter_logs_id.py
#0 0.988 - Alter field id on logs
#0 1.966 Operations to perform:
#0 1.966 Apply all migrations: accounts, admin, appsettings, auth, computes, contenttypes, instances, interfaces, logs, networks, otp_totp, sessions, storages
#0 1.966 Running migrations:
#0 1.966 Applying computes.0001_initial... OK
#0 1.973 Applying instances.0001_initial... OK
#0 1.980 Applying instances.0002_permissionset... OK
#0 1.984 Applying instances.0003_auto_20200615_0637... OK
#0 1.991 Applying contenttypes.0001_initial... OK
#0 1.996 Applying auth.0001_initial... OK
#0 2.011 Applying accounts.0001_initial... OK
#0 2.034 Applying accounts.0002_permissionset... OK
#0 2.038 Applying accounts.0003_auto_20200604_0930... OK
#0 2.054 Applying accounts.0004_auto_20200615_0637... OK
#0 2.082 Applying accounts.0005_auto_20200616_1039... OK
#0 2.091 Applying accounts.0006_alter_userattributes_id_alter_userinstance_id_and_more... OK
#0 2.114 Applying contenttypes.0002_remove_content_type_name... OK
#0 2.130 Applying auth.0002_alter_permission_name_max_length... OK
#0 2.140 Applying auth.0003_alter_user_email_max_length... OK
#0 2.149 Applying auth.0004_alter_user_username_opts... OK
#0 2.156 Applying auth.0005_alter_user_last_login_null... OK
#0 2.167 Applying auth.0006_require_contenttypes_0002... OK
#0 2.170 Applying auth.0007_alter_validators_add_error_messages... OK
#0 2.180 Applying auth.0008_alter_user_username_max_length... OK
#0 2.189 Applying auth.0009_alter_user_last_name_max_length... OK
#0 2.199 Applying auth.0010_alter_group_name_max_length... OK
#0 2.209 Applying auth.0011_update_proxy_permissions... OK
#0 2.217 Applying admin.0001_initial... OK
#0 2.221 Applying admin.0002_auto_20200609_0830... OK
#0 2.223 Applying admin.0003_create_group_technicians... OK
#0 2.231 Applying appsettings.0001_initial... OK
#0 2.235 Applying appsettings.0002_auto_20200527_1603... OK
#0 2.247 Applying appsettings.0003_auto_20200615_0637... OK
#0 2.254 Applying appsettings.0004_auto_20200716_0637... OK
#0 2.263 Applying appsettings.0005_auto_20200911_1233... OK
#0 2.267 Applying appsettings.0006_auto_20220630_0717... OK
#0 2.275 Applying appsettings.0007_auto_20220905_0918... OK
#0 2.286 Applying appsettings.0008_auto_20220905_1459... OK
#0 2.296 Applying appsettings.0009_alter_appsettings_id... OK
#0 2.305 Applying appsettings.0010_auto_20231030_1305... OK
#0 2.314 Applying auth.0012_alter_user_first_name_max_length... OK
#0 2.323 Applying computes.0002_auto_20200529_1320... OK
#0 2.330 Applying computes.0003_auto_20200615_0637... OK
#0 2.339 Applying computes.0004_alter_compute_id... OK
#0 2.350 Applying instances.0004_auto_20200618_0817... OK
#0 2.361 Applying instances.0005_flavor... OK
#0 2.365 Applying instances.0006_addFlavors... OK
#0 2.376 Applying instances.0007_auto_20200624_0821... OK
#0 2.382 Applying instances.0008_auto_20200708_0950... OK
#0 2.390 Applying instances.0009_auto_20200717_0524... OK
#0 2.393 Applying instances.0010_auto_20220722_0812... OK
#0 2.401 Applying instances.0011_createinstance_migrateinstance... OK
#0 2.405 Applying instances.0012_alter_flavor_id_alter_instance_id... OK
#0 2.419 Applying interfaces.0001_initial... OK
#0 2.423 Applying logs.0001_initial... OK
#0 2.426 Applying logs.0002_auto_20200615_0637... OK
#0 2.432 Applying logs.0003_logs_host... OK
#0 2.438 Applying logs.0004_alter_logs_id... OK
#0 2.443 Applying networks.0001_initial... OK
#0 2.447 Applying otp_totp.0001_initial... OK
#0 2.458 Applying otp_totp.0002_auto_20190420_0723... OK
#0 2.477 Applying sessions.0001_initial... OK
#0 2.484 Applying storages.0001_initial... OK
#0 2.842 * Creating default admin user
#0 2.842 ! SHOW_PROFILE_EDIT_PASSWORD is found inside settings.py
#0 2.842 * Applying permission can_change_password for all users
#0 2.842 ! Warning!!! Setting to True for all users
#0 2.842 ! Don`t forget to remove the option from settings.py
#0 2.842 * Migrating can_clone_instaces user attribute to permission
#0 2.842 * Applying permission passwordless_console for all users
#0 3.444 Traceback (most recent call last):
#0 3.445 File "/srv/webvirtcloud/manage.py", line 21, in <module>
#0 3.446 main()
#0 3.446 File "/srv/webvirtcloud/manage.py", line 17, in main
#0 3.446 execute_from_command_line(sys.argv)
#0 3.446 File "/srv/webvirtcloud/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
#0 3.446 utility.execute()
#0 3.446 File "/srv/webvirtcloud/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 436, in execute
#0 3.447 self.fetch_command(subcommand).run_from_argv(self.argv)
#0 3.447 File "/srv/webvirtcloud/venv/lib/python3.10/site-packages/django/core/management/base.py", line 412, in run_from_argv
#0 3.447 self.execute(*args, **cmd_options)
#0 3.447 File "/srv/webvirtcloud/venv/lib/python3.10/site-packages/django/core/management/base.py", line 458, in execute
#0 3.448 output = self.handle(*args, **options)
#0 3.448 File "/srv/webvirtcloud/venv/lib/python3.10/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 209, in handle
#0 3.448 collected = self.collect()
#0 3.448 File "/srv/webvirtcloud/venv/lib/python3.10/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 135, in collect
#0 3.448 handler(path, prefixed_path, storage)
#0 3.448 File "/srv/webvirtcloud/venv/lib/python3.10/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 368, in copy_file
#0 3.449 if not self.delete_file(path, prefixed_path, source_storage):
#0 3.449 File "/srv/webvirtcloud/venv/lib/python3.10/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 278, in delete_file
#0 3.449 if self.storage.exists(prefixed_path):
#0 3.449 File "/srv/webvirtcloud/venv/lib/python3.10/site-packages/django/core/files/storage/filesystem.py", line 165, in exists
#0 3.449 return os.path.lexists(self.path(name))
#0 3.450 File "/srv/webvirtcloud/venv/lib/python3.10/site-packages/django/contrib/staticfiles/storage.py", line 39, in path
#0 3.450 raise ImproperlyConfigured(
#0 3.450 django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path.
------
Dockerfile:43
--------------------
42 |
43 | >>> RUN . venv/bin/activate && \
44 | >>> python3 manage.py makemigrations && \
45 | >>> python3 manage.py migrate && \
46 | >>> python3 manage.py collectstatic --noinput && \
47 | >>> chown -R www-data:www-data /srv/webvirtcloud
48 |
--------------------
ERROR: failed to solve: process "/bin/sh -c . venv/bin/activate && \tpython3 manage.py makemigrations && python3 manage.py migrate && \tpython3 manage.py collectstatic --noinput && \tchown -R www-data:www-data /srv/webvirtcloud" did not complete successfully: exit code: 1
senhao-xu commented
I modified the settings. py
file with reference to 623, but there was an error
127 STATIC_URL = "/static/"
128
129 STATIC_ROOT = "static"
130
131 STATICFILES_DIRS = [
132 Path.joinpath(BASE_DIR, "webvirtcloud/static"),
133 ]
134
135
136 BS_ICONS_CACHE = Path.joinpath(BASE_DIR, 'static/icon_cache')
[root@localhost webvirtcloud]# docker build -t retspen/webvirtcloud:1 .
[+] Building 271.5s (11/20) docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.88kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 425B 0.0s
=> [internal] load metadata for docker.io/phusion/baseimage:jammy-1.0.1 3.6s
=> [ 1/16] FROM docker.io/phusion/baseimage:jammy-1.0.1@sha256:7faf4efcd96870fe090d969703ef8e727cc9de4f465c8442047ffd26f8094e6b 0.0s
=> [internal] load build context 0.1s
=> => transferring context: 128.23kB 0.1s
=> CACHED [ 2/16] RUN echo 'APT::Get::Clean=always;' >> /etc/apt/apt.conf.d/99AutomaticClean 0.0s
=> CACHED [ 3/16] RUN apt-get update -qqy && DEBIAN_FRONTEND=noninteractive apt-get -qyy install --no-install-recommends git python3-venv python3-dev python3-lxml lib 0.0s
=> [ 4/16] COPY . /srv/webvirtcloud 1.0s
=> [ 5/16] RUN chown -R www-data:www-data /srv/webvirtcloud 1.6s
=> [ 6/16] WORKDIR /srv/webvirtcloud 0.1s
=> ERROR [ 7/16] RUN python3 -m venv venv && . venv/bin/activate && pip3 install -U pip && pip3 install wheel && pip3 install -r conf/requirements.txt && pip3 cache purg 264.9s
------
> [ 7/16] RUN python3 -m venv venv && . venv/bin/activate && pip3 install -U pip && pip3 install wheel && pip3 install -r conf/requirements.txt && pip3 cache purge && chown -R www-data:www-data /srv/webvirtcloud:
8.239 Requirement already satisfied: pip in ./venv/lib/python3.10/site-packages (22.0.2)
28.27 WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f601ce23280>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pip/
48.79 WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f601ce235b0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pip/
69.81 WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f601ce23760>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pip/
91.84 WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f601ce23910>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pip/
115.9 WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f601ce23ac0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pip/
157.0 WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f012a4cf3a0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/wheel/
177.6 WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f012a4cf5b0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/wheel/
198.6 WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f012a4cf7c0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/wheel/
220.7 WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f012a4cfa60>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/wheel/
244.7 WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f012a4cfc10>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/wheel/
264.7 ERROR: Could not find a version that satisfies the requirement wheel (from versions: none)
264.7 ERROR: No matching distribution found for wheel
------
Dockerfile:35
--------------------
34 | WORKDIR /srv/webvirtcloud
35 | >>> RUN python3 -m venv venv && \
36 | >>> . venv/bin/activate && \
37 | >>> pip3 install -U pip && \
38 | >>> pip3 install wheel && \
39 | >>> pip3 install -r conf/requirements.txt && \
40 | >>> pip3 cache purge && \
41 | >>> chown -R www-data:www-data /srv/webvirtcloud
42 |
--------------------
ERROR: failed to solve: process "/bin/sh -c python3 -m venv venv && \t. venv/bin/activate && \tpip3 install -U pip && \tpip3 install wheel && \tpip3 install -r conf/requirements.txt && \tpip3 cache purge && \tchown -R www-data:www-data /srv/webvirtcloud" did not complete successfully: exit code: 1
[root@localhost webvirtcloud]#