Deploying Postgres and pgAdmin to Docker Swarm

How to create volumes and deploy Postgresql and pgAdmin mkdir -p /disk1/postgres_data mkdir -p /disk2/postgres_backup chmod -R 777 /disk1/postgres_data chmod -R 777 /disk2/postgres_backup Docker Swarm deployment manifest version: "3.8" services: postgres: image: postgres:15 deploy: placement: constraints: - "node.hostname == swarmnode1" volumes: - /disk1/postgres_data:/var/lib/postgresql/data - /disk2/postgres_backup:/backup environment: POSTGRES_USER: myuser POSTGRES_PASSWORD: mypassword POSTGRES_DB: mydatabase networks: - my_network ports: - "5432:5432" pgadmin: image: dpage/pgadmin4 deploy: placement: constraints: - "node.hostname == swarmnode1" volumes: - pgadmin_data:/var/lib/pgadmin environment: PGADMIN_DEFAULT_EMAIL: admin@example.com PGADMIN_DEFAULT_PASSWORD: adminpassword ports: - "7676:80" networks: - my_network networks: my_network: driver: overlay volumes: pgadmin_data:

February 2, 2025 · 1 min · Jens

Enabling and using Minikube Docker registry

Cheat-Sheet to enable and use Minikube internal Docker registry Enable access to insecure registry On Docker host machine, create or edit /etc/docker/daemon.json: { "insecure-registries" : ["192.168.49.2:5000"] } Save and restart Docker. Delete an existing Minikube cluster: minikube stop && minikube delete Start minikube with insecure registry access enabled: minikube start --insecure-registry "10.0.0.0/24" Enable the registry addon: minikube addons enable registry Tag an existing image and push it to minikube registry: ...

January 25, 2022 · 1 min · Jens

Testing Dockerized Webapp With Cucumber And Selenium

My task is to test a dockerized web application using Selenium. It is important that the tests are defined with Gherkin and of course run headless on Jenkins. Here is what I did to achieve this task. Cucumber And Testcontainer Specifics This is a snippet from the class responsible to pull and instantiate the Webapp container which contains the build of my webapp to test: @Slf4j public class WebappContainer { private static WebappContainer instance = new WebappContainer(); private static final String NETWORK_ALIAS = "WEBAPP"; private static final int EXPOSED_PORT = 7654; private static final DockerImageName dockerImageName = DockerImageName .parse("myecr.amazonaws.com/webapp/my-little-webapp:" + getWebappImageVersion()); public static final GenericContainer<?> container = new GenericContainer<>(dockerImageName) .withNetwork(NetworkUtils.getNetwork()) .withNetworkAliases(NETWORK_ALIAS) .waitingFor(Wait.forHttp("/").forStatusCode(200).forPort(PORT) .withStartupTimeout(Duration.ofSeconds(STARTUP_TIMEOUT))) .withExposedPorts(EXPOSED_PORT) .withLogConsumer(new Slf4jLogConsumer(log)) // next line maybe specific to my setup: Mount Spring Boot test config into container .withClasspathResourceMapping("application-test.yml", "/etc/config/application.yml", BindMode.READ_ONLY); private WebappContainer() { } public static WebappContainer getInstance() { return instance; } public void start() { container.start(); } public void stop() { container.stop(); } public boolean isRunning() { return container.isRunning(); } public int getHttpPort() { return container.getMappedPort(EXPOSED_PORT); } } For completeness sake here the static helper method to get the image ...

June 9, 2021 · 3 min · Jens

Setting Timezone with Maven Jib-Plugin in Docker Image

I run a dockerized Spring Boot Application on a Raspberry Pi Zero (yes…that’s possible). It records the current temperatures to a MariaDB (which is running on another RPi). At some point I noticed that the time stamps in the database had a time difference of exactly minus two hours. However, the docker host had the correct time zone (CEST, Europe/Berlin). The running Docker Container had the UTC timezone, though: $ docker exec 9106cb56b3f6 date Thu Apr 4 20:00:00 UTC 2020 ...

April 9, 2020 · 1 min · Jens