Dev Container vs. Prod Container in Airflow Using Docker

Context
We are encountering an error [Errno 6] No such device or address when running a script in Airflow that involves GPG encryption. The script works fine in the development container but fails in the production container. Here’s a detailed summary of the issue and the steps taken so far:
Issue Description

  • Error Message: [Errno 6] No such device or address
  • Environment: Airflow running in Docker containers (Dev and Prod)
  • Script: The script involves exporting data from Snowflake, encrypting it using GPG, and then sending it to an SFTP server.
    Key Observations
  1. GPG Configuration:
    • GPG home directory: /home/sbapp/.config/python-gnupg
    • GPG binary: /usr/bin/gpg
    • Warning in logs: gpg: WARNING: options in ‘/home/sbapp/.gnupg/gpg.conf’ are not yet active during this run
  2. Environment Variables:
    • PGP_PUBLIC_KEY and GNUPGHOME are set correctly in the environment.
  3. File Paths and Permissions:
    • The GPG home directory and its contents need to be readable and writable by the Airflow user.
    • Permissions and ownership checks are performed in the script.
  4. Detailed Logging:
    • Added detailed logging to capture environment variables, file paths, and permissions.
      Steps Taken
  5. Verified Environment Variables:
    • Ensured that PGP_PUBLIC_KEY and GNUPGHOME are set correctly in the Airflow environment.
  6. Checked File Paths and Permissions:
    • Verified that the file paths used in the script are correct and accessible in the Airflow environment.
    • Ensured that the GPG home directory and its contents are readable and writable by the Airflow user.
  7. Adjusted Directory Permissions:
    • Set the correct ownership and permissions for the GPG home directory and its contents.
  8. Updated Script:
    • Added detailed logging and error handling to the script.
    • Ensured that the GPG object is initialized with ignore_homedir_permissions set to True.

Hi @Pythonnoob247!

Does that involve that you were using the parameter -vvv for gpg? This parameter ensures the most verbose logging of GnuPG.

Which version of GnuPG are you using in the container?