What IP address ranges are available to Docker when creating gateways, for example when using Compose files

I have a naive question, but I noticed by playing with some Compose files, that docker creates gateway addresses in the form 172.x.0.1 for all the networks of my projects. x being normally always (?) incremented (unless the docker service is restarted), starting from 18 (because 17 is used by the default bridge network) up […]

By s k
Published
Categorised as docker, docker-compose, docker-networking Tagged , ,

What is the equivalent of –add-host=host.docker.internal:host-gateway in a Compose file

Starting from Docker version 20.10 (https://github.com/moby/moby/pull/40007), there is a new special string host-gateway that one can use within the –add-host run flag to allow a direct connection from inside a docker container to the local machine on Linux based systems. And this is very nice. But what is the equivalent of –add-host=host.docker.internal:host-gateway in a Compose […]

By s k
Published
Categorised as docker, docker-compose, docker-networking, linux Tagged , , ,

In docker config.json, how to get the IPAddress of the containers in the custom psFormat?

According to the documentation at: https://docs.docker.com/engine/reference/commandline/cli/#customize-the-default-output-format-for-commands I want to customize the docker ps output so that it shows the IP of the containers in the table results. What I’ve tried so far is: $ cat ~/.docker/config.json { "psFormat": "table {{.ID}}t{{.Image}}t{{.IPAddress}}t{{.Ports}}t{{.Names}}" } but then it raises this error: $ docker ps Template parsing error: template: :1:33: […]

By s k
Published
Categorised as docker Tagged

pgAdmin docker 2FA TOTP authentication error "Failed to validate the code"

I’m using dpage/pgadmin4:6.3 available at https://hub.docker.com/r/dpage/pgadmin4/ I’m trying to setup the 2FA TOTP based authentication by clicking on the top-right corner of the app (user icon) then on "Two-Factor Authentication" to open a new popup with the QR code displayed in my web browser (Firefox 95.0.2 at the time of writing). I scan the code […]

By s k
Published
Categorised as docker, pgadmin, two-factor-authentication Tagged , ,

From docker container on server A to db on server B using an SSH tunnel

I have a docker application running on a server A (let’s call it appA) and a dockerized PostgreSQL database running on a server B (along with an appB). I need to connect, from the appA container which is on server A to the database on server B. Server B is only accessible using an SSH […]

By s k
Published
Categorised as docker, postgresql, ssh, ssh-tunnel, ubuntu Tagged , , , ,

How to re-up exited containers when the –scale option was passed to docker-compose up?

For some reason, some docker containers have crashed after a while when using docker-compose up –scale app=20 app. e.g.: $ docker-compose ps Name Command State Ports ———————————————————— myproject_app_1 wait-for-it db … Up 8080/tcp myproject_app_2 wait-for-it db … Exit 1 myproject_app_3 wait-for-it db … Exit 1 myproject_app_4 wait-for-it db … Exit 1 myproject_app_5 wait-for-it db … […]

By s k
Published
Categorised as docker, docker-compose Tagged ,

Parallel slowdown occurs when running a docker application using the –scale option

I’m suffering parallel slowdown when scaling up a Python application using docker-compose up –scale. This application is mainly use for heavy geospatial computations (both on raster and vector data) using GeoPandas / rasterio / GDAL / … and writes data to a PostgreSQL + PosGIS database (also dockerized). For example, a feature which took 1’280 […]

Parallel slowdown occurs when runing a docker application using the –scale option

I’m suffering parallel slowdown when scaling up a Python application using docker-compose up –scale. This application is mainly use for heavy geospatial computations (both on raster and vector data) using GeoPandas / rasterio / GDAL / … and writes data to a PostgreSQL + PosGIS database (also dockerized). For example, a feature which took 1’280 […]

Should I install Python packages as non root user or set up a virtual environment to install them inside a Docker container?

When installing Python package through pip in a Dockerfile, such as: pip install –trusted-host pypi.python.org -r requirements.txt with requirements.txt, e.g. as: python-dotenv>=0.15.0 psycopg2>=2.8.6 sqlalchemy>=1.3.22 numpy>=1.19.0 rasterio>=1.1.8 pandas>=1.1.5 geopandas>=0.8.1 matplotlib>=3.3.0 seaborn>=0.11.0 I recently seen this warning: WARNING: Running pip as the ‘root’ user can result in broken permissions and conflicting behavior with the system package manager. […]

By s k
Published
Categorised as docker, pip, python Tagged , ,

How to separate a part of a docker app which only needs to be run once to do some data preparation on a database service?

I have a small Python application (not a web app) which is doing complex computations with data stored in a PostgreSQL database. The database is in a db docker-compose service. The Python app in an other one, app, in the same compose file, and it naturally depends on the database service. The problem is that […]

By s k
Published
Categorised as docker, docker-compose, python Tagged , ,

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq