TandoorRecipes / recipes

Application for managing recipes, planning meals, building shopping lists and much much more!
https://docs.tandoor.dev
Other
5.54k stars 584 forks source link

Recipe import fails / Server Error 500 #1344

Closed Howy76 closed 2 years ago

Howy76 commented 2 years ago

Issue

Hi there, I'm new here and trying my hand at the recipe database. Thank you for the great project. The database works for me so far and I can also create new users and recipes myself. However, I cannot import recipes from any external site. In the frontend I get a red popup window and the message: Server Error (500). I have an Apache server running on port 80 with a small homepage. I don't have a domain and I don't want external access to the database.

The container seems to be running fine for me: pi@raspberrypi:/opt/tandoor $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 64fd832847e5 nginx:mainline-alpine "/docker-entrypoint.…" 2 hours ago Up 9 minutes 0.0.0.0:8090->80/tcp, :::8090->80/tcp tandoor-nginx_recipes-1 0cffee96becb vabene1111/recipes "/opt/recipes/boot.sh" 2 hours ago Up 9 minutes 8080/tcp tandoor-web_recipes-1 eba676f107de postgres:11-alpine "docker-entrypoint.s…" 2 hours ago Up 10 minutes 5432/tcp tandoor-db_recipes-1

Have I perhaps forgotten a small configuration?

Tandoor Version

1.0.4

OS Version

Raspberry Pi / Buster

Setup

Docker / Docker-Compose

Reverse Proxy

No reverse proxy

Other

No response

Environment file

# only set this to true when testing/debugging
# when unset: 1 (true) - dont unset this, just for development
DEBUG=0
SQL_DEBUG=0

# hosts the application can run under e.g. recipes.mydomain.com,cooking.mydomain.com,...
ALLOWED_HOSTS=*

# random secret key, use for example `base64 /dev/urandom | head -c50` to generate one
# ---------------------------- REQUIRED -------------------------
SECRET_KEY=++++++
# ---------------------------------------------------------------

# your default timezone See https://timezonedb.com/time-zones for a list of timezones
TIMEZONE=Europe/Berlin

# add only a database password if you want to run with the default postgres, otherwise change settings accordingly
DB_ENGINE=django.db.backends.postgresql
# DB_OPTIONS= {} # e.g. {"sslmode":"require"} to enable ssl
POSTGRES_HOST=db_recipes
POSTGRES_PORT=5432
POSTGRES_USER=djangouser
# ---------------------------- REQUIRED -------------------------
POSTGRES_PASSWORD=++++++
# ---------------------------------------------------------------
POSTGRES_DB=djangodb

# database connection string, when used overrides other database settings.
# format might vary depending on backend
# DATABASE_URL = engine://username:password@host:port/dbname

# the default value for the user preference 'fractions' (enable/disable fraction support)
# default: disabled=0
FRACTION_PREF_DEFAULT=0

# the default value for the user preference 'comments' (enable/disable commenting system)
# default comments enabled=1
COMMENT_PREF_DEFAULT=1

# Users can set a amount of time after which the shopping list is refreshed when they are in viewing mode
# This is the minimum interval users can set. Setting this to low will allow users to refresh very frequently which
# might cause high load on the server. (Technically they can obviously refresh as often as they want with their own scripts)
SHOPPING_MIN_AUTOSYNC_INTERVAL=5

# Default for user setting sticky navbar
# STICKY_NAV_PREF_DEFAULT=1

# If base URL is something other than just /  (you are serving a subfolder in your proxy for instance http://recipe_app/recipes/)
# SCRIPT_NAME=/recipes

# If staticfiles are stored at a different location uncomment and change accordingly, MUST END IN /
# this is not required if you are just using a subfolder
# This can either be a relative path from the applications base path or the url of an external host
# STATIC_URL=/static/

# If mediafiles are stored at a different location uncomment and change accordingly, MUST END IN /
# this is not required if you are just using a subfolder
# This can either be a relative path from the applications base path or the url of an external host
# MEDIA_URL=/media/

# Serve mediafiles directly using gunicorn. Basically everyone recommends not doing this. Please use any of the examples
# provided that include an additional nxginx container to handle media file serving.
# If you know what you are doing turn this back on (1) to serve media files using djangos serve() method.
# when unset: 1 (true) - this is temporary until an appropriate amount of time has passed for everyone to migrate
GUNICORN_MEDIA=0

# S3 Media settings: store mediafiles in s3 or any compatible storage backend (e.g. minio)
# as long as S3_ACCESS_KEY is not set S3 features are disabled
# S3_ACCESS_KEY=
# S3_SECRET_ACCESS_KEY=
# S3_BUCKET_NAME=
# S3_REGION_NAME= # default none, set your region might be required
# S3_QUERYSTRING_AUTH=1 # default true, set to 0 to serve media from a public bucket without signed urls
# S3_QUERYSTRING_EXPIRE=3600 # number of seconds querystring are valid for
# S3_ENDPOINT_URL= # when using a custom endpoint like minio

# Email Settings, see https://docs.djangoproject.com/en/3.2/ref/settings/#email-host
# Required for email confirmation and password reset (automatically activates if host is set)
# EMAIL_HOST=
# EMAIL_PORT=
# EMAIL_HOST_USER=
# EMAIL_HOST_PASSWORD=
# EMAIL_USE_TLS=0
# EMAIL_USE_SSL=0
# DEFAULT_FROM_EMAIL= # email sender address (default 'webmaster@localhost')
# ACCOUNT_EMAIL_SUBJECT_PREFIX= # prefix used for account related emails (default "[Tandoor Recipes] ")

# allow authentication via reverse proxy (e.g. authelia), leave off if you dont know what you are doing
# see docs for more information https://vabene1111.github.io/recipes/features/authentication/
# when unset: 0 (false)
REVERSE_PROXY_AUTH=0

# Default settings for spaces, apply per space and can be changed in the admin view
# SPACE_DEFAULT_MAX_RECIPES=0 # 0=unlimited recipes
# SPACE_DEFAULT_MAX_USERS=0 # 0=unlimited users per space
# SPACE_DEFAULT_MAX_FILES=0 # Maximum file storage for space in MB. 0 for unlimited, -1 to disable file upload.
# SPACE_DEFAULT_ALLOW_SHARING=1 # Allow users to share recipes with public links

# allow people to create accounts on your application instance (without an invite link)
# when unset: 0 (false)
# ENABLE_SIGNUP=0

# If signup is enabled you might want to add a captcha to it to prevent spam
# HCAPTCHA_SITEKEY=
# HCAPTCHA_SECRET=

# if signup is enabled you might want to provide urls to data protection policies or terms and conditions
# TERMS_URL=
# PRIVACY_URL=
# IMPRINT_URL=

# enable serving of prometheus metrics under the /metrics path
# ATTENTION: view is not secured (as per the prometheus default way) so make sure to secure it
# trough your web server (or leave it open of you dont care if the stats are exposed)
# ENABLE_METRICS=0

# allows you to setup OAuth providers
# see docs for more information https://vabene1111.github.io/recipes/features/authentication/
# SOCIAL_PROVIDERS = allauth.socialaccount.providers.github, allauth.socialaccount.providers.nextcloud,

# Should a newly created user from a social provider get assigned to the default space and given permission by default ?
# ATTENTION: This feature might be deprecated in favor of a space join and public viewing system in the future
# default 0 (false), when 1 (true) users will be assigned space and group
# SOCIAL_DEFAULT_ACCESS = 1

# if SOCIAL_DEFAULT_ACCESS is used, which group should be added
# SOCIAL_DEFAULT_GROUP=guest

# Django session cookie settings. Can be changed to allow a single django application to authenticate several applications
# when running under the same database
# SESSION_COOKIE_DOMAIN=.example.com
# SESSION_COOKIE_NAME=sessionid # use this only to not interfere with non unified django applications under the same top level domain

# by default SORT_TREE_BY_NAME is disabled this will store all Keywords and Food in the order they are created
# enabling this setting makes saving new keywords and foods very slow, which doesn't matter in most usecases.
# however, when doing large imports of recipes that will create new objects, can increase total run time by 10-15x
# Keywords and Food can be manually sorted by name in Admin
# This value can also be temporarily changed in Admin, it will revert the next time the application is started
# This will be fixed/changed in the future by changing the implementation or finding a better workaround for sorting
# SORT_TREE_BY_NAME=0
# LDAP authentication
# default 0 (false), when 1 (true) list of allowed users will be fetched from LDAP server
#LDAP_AUTH=
#AUTH_LDAP_SERVER_URI=
#AUTH_LDAP_BIND_DN=
#AUTH_LDAP_BIND_PASSWORD=
#AUTH_LDAP_USER_SEARCH_BASE_DN=

# Enables exporting PDF (see export docs)
# Disabled by default, uncomment to enable
# ENABLE_PDF_EXPORT=1

Docker-Compose file

version: "3"
services:
  db_recipes:
    restart: always
    image: postgres:11-alpine
    volumes:
      - ./postgresql:/var/lib/postgresql/data
    env_file:
      - ./.env
    security_opt:
      - seccomp:unconfined

  web_recipes:
    image: vabene1111/recipes
    restart: always
    env_file:
      - ./.env
    volumes:
      - staticfiles:/opt/recipes/staticfiles
      - nginx_config:/opt/recipes/nginx/conf.d
      - ./mediafiles:/opt/recipes/mediafiles
    depends_on:
      - db_recipes

  nginx_recipes:
    image: nginx:mainline-alpine
    restart: always
    ports:
      - 8090:80
    env_file:
      - ./.env
    depends_on:
      - web_recipes
    volumes:
      - nginx_config:/etc/nginx/conf.d:ro
      - staticfiles:/static
      - ./mediafiles:/media

volumes:
  nginx_config:
  staticfiles:

Relevant logs

pi@raspberrypi:/srv $ cd /opt/tandoor
pi@raspberrypi:/opt/tandoor $ vim docker-compose.yml
pi@raspberrypi:/opt/tandoor $ docker compose stop && docker compose up
[+] Running 3/3
 ⠿ Container tandoor-nginx_recipes-1  Stopped                                                                                                                             0.8s
 ⠿ Container tandoor-web_recipes-1    Stopped                                                                                                                             1.8s
 ⠿ Container tandoor-db_recipes-1     Stopped                                                                                                                             0.6s
[+] Running 3/0
 ⠿ Container tandoor-db_recipes-1     Created                                                                                                                             0.0s
 ⠿ Container tandoor-web_recipes-1    Created                                                                                                                             0.0s
 ⠿ Container tandoor-nginx_recipes-1  Created                                                                                                                             0.0s
Attaching to tandoor-db_recipes-1, tandoor-nginx_recipes-1, tandoor-web_recipes-1
tandoor-db_recipes-1     |
tandoor-db_recipes-1     | PostgreSQL Database directory appears to contain a database; Skipping initialization
tandoor-db_recipes-1     |
tandoor-db_recipes-1     | 2022-01-17 10:38:21.607 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
tandoor-db_recipes-1     | 2022-01-17 10:38:21.607 UTC [1] LOG:  listening on IPv6 address "::", port 5432
tandoor-db_recipes-1     | 2022-01-17 10:38:21.618 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
tandoor-db_recipes-1     | 2022-01-17 10:38:21.671 UTC [21] LOG:  database system was shut down at 2022-01-17 10:38:19 UTC
tandoor-db_recipes-1     | 2022-01-17 10:38:21.690 UTC [1] LOG:  database system is ready to accept connections
tandoor-web_recipes-1    | Updating database
tandoor-nginx_recipes-1  | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
tandoor-nginx_recipes-1  | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
tandoor-nginx_recipes-1  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
tandoor-nginx_recipes-1  | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist
tandoor-nginx_recipes-1  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
tandoor-nginx_recipes-1  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
tandoor-nginx_recipes-1  | /docker-entrypoint.sh: Configuration complete; ready for start up
tandoor-nginx_recipes-1  | 2037/05/13 12:23:20 [notice] 1#1: using the "epoll" event method
tandoor-nginx_recipes-1  | 2037/05/13 12:23:20 [notice] 1#1: nginx/1.21.5
tandoor-nginx_recipes-1  | 2037/05/13 12:23:20 [notice] 1#1: built by gcc 10.3.1 20211027 (Alpine 10.3.1_git20211027)
tandoor-nginx_recipes-1  | 2037/05/13 12:23:20 [notice] 1#1: OS: Linux 5.10.63-v7+
tandoor-nginx_recipes-1  | 2037/05/13 12:23:20 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
tandoor-nginx_recipes-1  | 2037/05/13 12:23:20 [notice] 1#1: start worker processes
tandoor-nginx_recipes-1  | 2037/05/13 12:23:20 [notice] 1#1: start worker process 23
tandoor-nginx_recipes-1  | 2037/05/13 12:23:20 [notice] 1#1: start worker process 24
tandoor-nginx_recipes-1  | 2037/05/13 12:23:20 [notice] 1#1: start worker process 25
tandoor-nginx_recipes-1  | 2037/05/13 12:23:20 [notice] 1#1: start worker process 26
tandoor-web_recipes-1    | Operations to perform:
tandoor-web_recipes-1    |   Apply all migrations: account, admin, auth, authtoken, contenttypes, cookbook, sessions, sites, socialaccount
tandoor-web_recipes-1    | Running migrations:
tandoor-web_recipes-1    |   No migrations to apply.
tandoor-web_recipes-1    | js-reverse file written to /opt/recipes/cookbook/static/django_js_reverse
tandoor-web_recipes-1    |
tandoor-web_recipes-1    | 1 static file copied to '/opt/recipes/staticfiles', 1018 unmodified, 1920 post-processed.
tandoor-web_recipes-1    | Done
tandoor-web_recipes-1    | [2022-01-17 10:39:07 +0000] [1] [INFO] Starting gunicorn 20.1.0
tandoor-web_recipes-1    | [2022-01-17 10:39:07 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
tandoor-web_recipes-1    | [2022-01-17 10:39:07 +0000] [1] [INFO] Using worker: sync
tandoor-web_recipes-1    | [2022-01-17 10:39:07 +0000] [11] [INFO] Booting worker with pid: 11
tandoor-web_recipes-1    | ERROR:django.request:Internal Server Error: /api/recipe-from-source/
tandoor-web_recipes-1    | Traceback (most recent call last):
tandoor-web_recipes-1    |   File "/opt/recipes/venv/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn
tandoor-web_recipes-1    |     conn = connection.create_connection(
tandoor-web_recipes-1    |   File "/opt/recipes/venv/lib/python3.9/site-packages/urllib3/util/connection.py", line 73, in create_connection
tandoor-web_recipes-1    |     for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
tandoor-web_recipes-1    |   File "/usr/local/lib/python3.9/socket.py", line 953, in getaddrinfo
tandoor-web_recipes-1    |     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
tandoor-web_recipes-1    | socket.gaierror: [Errno -3] Try again
tandoor-web_recipes-1    |
tandoor-web_recipes-1    | During handling of the above exception, another exception occurred:
tandoor-web_recipes-1    |
tandoor-web_recipes-1    | Traceback (most recent call last):
tandoor-web_recipes-1    |   File "/opt/recipes/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
tandoor-web_recipes-1    |     httplib_response = self._make_request(
tandoor-web_recipes-1    |   File "/opt/recipes/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 382, in _make_request
tandoor-web_recipes-1    |     self._validate_conn(conn)
tandoor-web_recipes-1    |   File "/opt/recipes/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
tandoor-web_recipes-1    |     conn.connect()
tandoor-web_recipes-1    |   File "/opt/recipes/venv/lib/python3.9/site-packages/urllib3/connection.py", line 358, in connect
tandoor-web_recipes-1    |     conn = self._new_conn()
tandoor-web_recipes-1    |   File "/opt/recipes/venv/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn
tandoor-web_recipes-1    |     raise NewConnectionError(
tandoor-web_recipes-1    | urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x73c7ea00>: Failed to establish a new connection: [Errno -3] Try again
tandoor-web_recipes-1    |
tandoor-web_recipes-1    | During handling of the above exception, another exception occurred:
tandoor-web_recipes-1    |
tandoor-web_recipes-1    | Traceback (most recent call last):
tandoor-web_recipes-1    |   File "/opt/recipes/venv/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
tandoor-web_recipes-1    |     resp = conn.urlopen(
tandoor-web_recipes-1    |   File "/opt/recipes/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen
tandoor-web_recipes-1    |     retries = retries.increment(
tandoor-web_recipes-1    |   File "/opt/recipes/venv/lib/python3.9/site-packages/urllib3/util/retry.py", line 574, in increment
tandoor-web_recipes-1    |     raise MaxRetryError(_pool, url, error or ResponseError(cause))
tandoor-web_recipes-1    | urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.chefkoch.de', port=443): Max retries exceeded with url: /rezepte/1598391267089394/Gebratene-Nudeln-mit-Gemuese-asiatisch.html (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x73c7ea00>: Failed to establish a new connection: [Errno -3] Try again'))
tandoor-web_recipes-1    |
tandoor-web_recipes-1    | During handling of the above exception, another exception occurred:
tandoor-web_recipes-1    |
tandoor-web_recipes-1    | Traceback (most recent call last):
tandoor-web_recipes-1    |   File "/opt/recipes/venv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
tandoor-web_recipes-1    |     response = get_response(request)
tandoor-web_recipes-1    |   File "/opt/recipes/venv/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
tandoor-web_recipes-1    |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
tandoor-web_recipes-1    |   File "/opt/recipes/venv/lib/python3.9/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
tandoor-web_recipes-1    |     return view_func(request, *args, **kwargs)
tandoor-web_recipes-1    |   File "/opt/recipes/cookbook/views/api.py", line 900, in recipe_from_source
tandoor-web_recipes-1    |     scrape = scrape_me(url)
tandoor-web_recipes-1    |   File "/opt/recipes/venv/lib/python3.9/site-packages/recipe_scrapers/__init__.py", line 368, in scrape_me
tandoor-web_recipes-1    |     return scraper(url_path, **options)
tandoor-web_recipes-1    |   File "/opt/recipes/venv/lib/python3.9/site-packages/recipe_scrapers/_abstract.py", line 33, in __init__
tandoor-web_recipes-1    |     page_data = requests.get(
tandoor-web_recipes-1    |   File "/opt/recipes/venv/lib/python3.9/site-packages/requests/api.py", line 75, in get
tandoor-web_recipes-1    |     return request('get', url, params=params, **kwargs)
tandoor-web_recipes-1    |   File "/opt/recipes/venv/lib/python3.9/site-packages/requests/api.py", line 61, in request
tandoor-web_recipes-1    |     return session.request(method=method, url=url, **kwargs)
tandoor-web_recipes-1    |   File "/opt/recipes/venv/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
tandoor-web_recipes-1    |     resp = self.send(prep, **send_kwargs)
tandoor-web_recipes-1    |   File "/opt/recipes/venv/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
tandoor-web_recipes-1    |     r = adapter.send(request, **kwargs)
tandoor-web_recipes-1    |   File "/opt/recipes/venv/lib/python3.9/site-packages/requests/adapters.py", line 516, in send
tandoor-web_recipes-1    |     raise ConnectionError(e, request=request)
tandoor-web_recipes-1    | requests.exceptions.ConnectionError: HTTPSConnectionPool(host='www.chefkoch.de', port=443): Max retries exceeded with url: /rezepte/1598391267089394/Gebratene-Nudeln-mit-Gemuese-asiatisch.html (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x73c7ea00>: Failed to establish a new connection: [Errno -3] Try again'))
tandoor-nginx_recipes-1  | 10.10.10.20 - - [13/May/2037:12:22:00 +0000] "POST /api/recipe-from-source/ HTTP/1.1" 500 145 "http://10.10.10.4:8090/data/import/url" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:96.0) Gecko/20100101 Firefox/96.0" "-"
tandoor-web_recipes-1    | 172.18.0.4 - - [17/Jan/2022:11:39:31 +0100] "POST /api/recipe-from-source/ HTTP/1.0" 500 145 "http://10.10.10.4:8090/data/import/url" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:96.0) Gecko/20100101 Firefox/96.0"
vabene1111 commented 2 years ago

do you have your server in a datacenter that might be blocked by chefkoch ? can you try a few different websites to import from ?

generally speaking we have implemented a proper error catch for the future but the issue your log shows indicates that chefkoch is refusing your conneciton

Howy76 commented 2 years ago

Unfortunately, all pages are blocked. My server is a small RaspPi that I have at home. I can also use other browsers like Edge, Chrome or Brave. All the same error message. The recipe pages are displayed normally in the browser.

vabene1111 commented 2 years ago

interesting, i can import from all of those sites. Is there any firewall or network service that could block the requests from your PI ?

Howy76 commented 2 years ago

A firewall (ufw) is not installed. However, I have a network filter running for my home network. It filters the advertising out of the pages for me. PiHole. This filter does not show me any restrictions for the recipe pages. I have already whitelisted them. Brings no improvement. If I disable it, it doesn't work either. Nothing else is installed. I'm a little confused...

smilerz commented 2 years ago

The db_recipes container has a console - what happens when you try wget www.lecker.de from that console??

Howy76 commented 2 years ago

Do you mean it like this:

pi@raspberrypi:~ $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 64fd832847e5 nginx:mainline-alpine "/docker-entrypoint.…" 9 hours ago Up 38 minutes 0.0.0.0:8090->80/tcp, :::8090->80/tcp tandoor-nginx_recipes-1 0cffee96becb vabene1111/recipes "/opt/recipes/boot.sh" 9 hours ago Up 39 minutes 8080/tcp tandoor-web_recipes-1 eba676f107de postgres:11-alpine "docker-entrypoint.s…" 9 hours ago Up 39 minutes 5432/tcp tandoor-db_recipes-1 pi@raspberrypi:~ $ docker exec -it eba676f107de bash bash-5.1# wget www.lecker.de wget: bad address 'www.lecker.de' bash-5.1# wget https://www.chefkoch.de/ wget: bad address 'www.chefkoch.de' bash-5.1#

smilerz commented 2 years ago

@Howy76 - it doesn't look like your docker container has a functional DNS or can't access the internet - you will need to fix that before url import will function.

Howy76 commented 2 years ago

@smilerz You were right about the faulty DNS. I have in the file

/etc/network/interfaces

added the following entry.

auto eth0 iface eth0 inet dhcp dns-nameservers 8.8.8.8

This gave the container access to the internet and the recipe import functioned.

Thank you very much for your hint.