简体   繁体   中英

disconnected from airflow docker container after ~10 s

I successfully created and started this container:

https://github.com/puckel/docker-airflow

by running:

docker build --rm --build-arg AIRFLOW_DEPS="datadog,dask" --build-arg PYTHON_DEPS="flask_oauthlib>=0.9" -t puckel/docker-airflow .

docker-compose -f docker-compose-CeleryExecutor.yml up -d

Then i just wanted to add java to images:

I added at the end:

https://github.com/puckel/docker-airflow/blob/master/Dockerfile#L83

USER airflow
WORKDIR ${AIRFLOW_USER_HOME}
ENTRYPOINT ["/entrypoint.sh"]
CMD ["webserver"] # set default arg for entrypoint

# my new code :
USER root
RUN mkdir -p /usr/share/man/man1/

# Install OpenJDK-8
RUN apt-get update && \
apt-get install -y openjdk-8-jdk && \
apt-get install -y ant && \
apt-get clean;

# Fix certificate issues
RUN apt-get update && \
apt-get install ca-certificates-java && \
apt-get clean && \
update-ca-certificates -f;
# Setup JAVA_HOME -- useful for docker commandline
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/

After building and running the container, i'm trying to connect like i did before instaling java:

docker exec -it docker-airflow_worker_1 /bin/bash

But i'm automaticaly disconnected. And java is installed

root@5475d28fb5f5:/usr/local/airflow# java -version 
openjdk version "1.8.0_232"
OpenJDK Runtime Environment (build 1.8.0_232-8u232-b09-1~deb9u1-b09)
OpenJDK 64-Bit Server VM (build 25.232-b09, mixed mode)
root@5475d28fb5f5:/usr/local/airflow# %                                                      

And when i log the container:

User information: uid=0 euid=0 gid=0 egid=0

[2019-10-31 12:07:40,312] {{settings.py:213}} INFO - settings.configure_orm(): Using pool settings. pool_size=5, max_overflow=10, pool_recycle=1800, pid=1
/usr/local/lib/python3.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
  """)
[2019-10-31 12:07:40,621] {{__init__.py:51}} INFO - Using executor CeleryExecutor
Running a worker with superuser privileges when the
worker accepts messages serialized with pickle is a very bad idea!

If you really want to continue then you have to set the C_FORCE_ROOT
environment variable (but please think about this before you do).

User information: uid=0 euid=0 gid=0 egid=0

Can anyone help?

Thanks

So you changed user to root in Dockerfile and Airflow now refuses to start. Try to move your new code in Dockerfile before USER airflow line. Also you can delete USER root line after that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM