Declare env variable which value include space for docker/docker-compose

Lets see the result running the following compose file: version: “3” services: service: image: alpine command: env env_file: env.conf env.conf: TEST_VAR1=The value TEST_VAR2=”The value2″ docker-compose up Result: service_1 | PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin service_1 | TEST_VAR2=”The value2″ service_1 | TEST_VAR1=The value service_1 | HOME=/root Therefore, it is legal to have spaces in the env value.

Docker MySQL connection DBeaver

For those who are running DB on different machine, you can do the following: First, from where the container is, run docker ps to get the containers details including the Container ID [root@test-001 ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1b02333fb3b9 tutum/nginx “/usr/sbin/nginx” 6 weeks ago Up 7 days 0.0.0.0:80->80/tcp docker_nginx_1 … Read more

How to run docker-compose commands with ansible?

Updated answer 02/2024: docker_compose_v2 is out since community.docker v3.6.0. You can copy docker-compose.yml and run Compose such as: – name: copy Docker Compose files copy: src: files/{{ item }} dest: /somewhere/yourproject/{{ item }} loop: – docker-compose.yml – docker-compose.prod.yml # use files parameter to use multiple docker-compose.yml files # mind the _v2 suffix – name: deploy … Read more

Gunicorn ImportError: cannot import name ‘ALREADY_HANDLED’ from ‘eventlet.wsgi’ in docker

Installing older version of eventlet solved the problem: pip install eventlet==0.30.2 EDIT: you can use the newer versions like this: pip install eventlet==0.33.0 https://github.com/benoitc/gunicorn/archive/refs/heads/master.zip#egg=gunicorn==20.1.0 see: https://github.com/benoitc/gunicorn/pull/2581#issuecomment-994198667 thank you @jmunsch

Pass environment variables from docker-compose to container at build stage

Your docker-compose.yml should look like this: version: ‘2’ services: web: build: context: ./web args: REQUIREMENTS: “requirements_dev.txt” Your Dockerfile should define the build-argument using ARG like this: FROM python:3.5 ENV PYTHONUNBUFFERED 1 ENV APP_ROOT /usr/src/app ARG REQUIREMENTS … COPY $REQUIREMENTS $APP_ROOT/ RUN pip install -r $APP_ROOT/$REQUIREMENTS I validated this and created a minified functional demo at … Read more

Docker EXPOSE using run-time environment variables

A little late but you could also use build args and change your code to: FROM python:3.6.5-stretch [ … ] ARG MY_SERVICE_PORT=8080 ARG MY_SERVICE_PORT_RPC=50051 # 8080 and 50051 would be the defaults [ … ] # Still functions like environment variables 🙂 EXPOSE ${MY_SERVICE_PORT} EXPOSE ${MY_SERVICE_PORT_RPC} Then you can build with docker build –build-arg MY_SERVICE_PORT=80 … Read more

How to mount volume from container to host in Docker?

Bind mounts don’t copy data from the container > host. Host volumes mount over the top of what’s in the container/image, so they effectively replace what’s in the container with what’s on the host. docker run -v /path/to/hostdir:/var/whatever myimage A standard or “named” volume will copy the existing data from the container image when the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)