[SRE / Docker] Start control with Dockerize

I will write about Dockerize which is convenient when you want to wait for DB connection when using docker-compose.

Start control options

As far as I can see below, it seems that wait-for-it and dockerize are valid. Controlling the startup order in Compose — Docker-docs-ja 17.06 Document

Wait until MySQL starts with Docker Compose-Qiita How to wait until MySQL starts with docker-compose up (2 types introduced) --Qiita

Dockerize

What is Dockerize

GitHub - jwilder/dockerize: Utility to simplify running applications in docker containers

use

Modify dockerfile and docker-compose.yaml.

ENV DOCKERIZE_VERSION v0.6.0
RUN apk add --no-cache openssl \
    && wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
    && tar -C /usr/local/bin -xzvf dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
    && rm dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz

Define the dockerize command with docker-compose. The command dockerize -wait tcp: // db: 5432 will allow you to wait for the dependent application to start.

entrypoint:
  - dockerize
  - -timeout
  - 60s
  - -wait
  - tcp://mysql:3306
command: ./main #Run with go

Wait for other containers to start using Dockerize-Qiita

Recommended Posts

[SRE / Docker] Start control with Dockerize
Version control CocoaPods with Docker
mysql doesn't start up with docker.
[Linux] Start Apache container with Docker
How to start Camunda with Docker
Docker + Spring-boot start
Start SQL Server with Docker & register initial data
Launch MariaDB with Docker
Run Pico with docker
Explode Docker with WSL2
Use Puphpeteer with Docker
Operate Emby with Docker
Start k3s with docker-compose
Try WildFly with Docker
Use ngrok with Docker
Docker Compose does not start with docker.credentials.errors.InitializationError error message
Run Payara with Docker
[Docker] Connection with MySQL
Php settings with Docker
Getting Started with Docker
Disposable PHP with Docker
Install Composer with Docker
Wait for the container service to start with docker healthcheck
Java: Start WAS with Docker and deploy your own application
Pytorch execution environment with Docker
Use GDAL with Python with Docker
[Rails 6] Dockerize existing Rails apps [Docker]
Start Apache Solr with Embedded.
Deploy with EC2 / Docker / Laravel
Run TAO Core with Docker
docker review image creation-container start
Set up GitLab with docker
Version control Java with SDKMAN
Run Rails whenever with docker
Java version control with jenv
Get started with DynamoDB with docker
Docker autostart settings with wsl2
[Docker] Rails 5.2 environment construction with docker
Spring Boot starting with Docker
Build docker environment with WSL
Web application built with docker (1)
I tried BIND with Docker
React environment construction with Docker
Build DynamoDB local with Docker
[Docker] Use whenever with Docker + Rails
Using PlantUml with Honkit [Docker]
Try Oracle Enterprise Manager Cloud Control with Docker Desktop for Windows
Image Spring Boot app using jib-maven-plugin and start it with Docker