Questions tagged [docker-entrypoint]

180 questions
3
votes
1 answer

postgresql: dockerfile create user and database from entrypoint script

I have a Dockerfile COPY ./docker-entrypoint.sh / RUN chmod +x /docker-entrypoint.sh USER postgres ENTRYPOINT ["/docker-entrypoint.sh"] where docker-entrypoint.sh is: #!/bin/sh # Before PostgreSQL can function correctly, the database cluster…
Santhosh
  • 9,965
  • 20
  • 103
  • 243
3
votes
1 answer

entrypoint.sh exec: @: not found

I was following this tutorial: https://docs.docker.com/compose/rails/ I want to create a Ruby On Rails API with PostgreSQL Database (Dockerized) But when I run docker-compose run web rails new . --force --no-deps --api --database=postgresql I got…
3
votes
1 answer

docker-entrypoint best practice for script execution

I want to run a couple of scripts on my docker-entrypoint.sh; My question if whether it makes any difference and if it does, what is the recommended way of going about this, regarding the following options: A. ${HOMEDIR}/myscript --param1…
pkaramol
  • 16,451
  • 43
  • 149
  • 324
3
votes
2 answers

Inspect non-daemon Docker container, after it has completed running

I have a container that I create with # start docker build -t cdt-tests . docker run -it --name cdt-tests cdt-tests # end => I want to inspect the container filesystem after it's done because it's not running in detached mode, how can I inspect the…
Alexander Mills
  • 90,741
  • 139
  • 482
  • 817
2
votes
0 answers

Kafka consumer script hangs when executed as a docker entrypoint

I am trying to connect a python kafka consumer to a kafka broker using the following script: import kafka from configuration import config if __name__ == "__main__": print('Start') consumer = kafka.KafkaConsumer( …
Charalamm
  • 1,547
  • 1
  • 11
  • 27
2
votes
2 answers

Access env variables inside docker entrypoint script

I want to pass environment variables in my docker run command and access them in my entrypoint shell script. This is my super simple Dockerfile for test purposes: FROM ubuntu:20.04 WORKDIR / ADD entrypoint.sh . RUN chmod 755…
Laurenz Glück
  • 1,762
  • 3
  • 17
  • 38
2
votes
1 answer

Run the cron job in the background inside the docker-entrypoint.sh file

I would like to run an initiator script and a cron job to run an updater script, both are in a Docker container that has a connection to the mongo database. Could someone help me how to run the cron job in the background inside the…
Maykon Meneghel
  • 335
  • 6
  • 8
2
votes
2 answers

how to execute sql script after oracle docker container startup?

I have setup docker container with spring boot + oracle DB. I need to run one sql script when oracle container startup. I tried below approach but container stuck in docker-entrypoint shell script waiting for database…
2
votes
4 answers

docker-compose.yml with entrypoint. file not found

Tried a lot already, but doesn't want to run docker-compose with entrypoint... I'm new to docker and trying to figure it out, but I can't seem to run the program through entrypoint.sh Dockerfile FROM python:3.7-alpine WORKDIR /app RUN apk update…
gohxr
  • 101
  • 3
  • 10
2
votes
0 answers

How to debug entrypoint of Dockerfile?

I try to run laravel in docker with external mysql. In docker-compose.yml I use depends_on for db. entrypoint.sh works perfectly with exec, but in Dockerfile ENTRYPOINT["/etc/entrypoint.sh"] does nothing. My Dockefile FROM php:7.4-fpm as…
2
votes
0 answers

how to run docker CMD as root after USER was changed

I have a docker image that runs on linux alpine. Sudo is not installed. I would like to build the image with a non-root user but I need to run a start script from CMD as root after the image is build. I need to open the container in vscode and if…
user2911833
  • 21
  • 1
  • 3
2
votes
0 answers

bash script switch user with exec

I would like to run a docker entrypoint that creates a new user, switches to that user and destroys root shell so it cannot be exited back into In the command line this works $ useradd -s /bin/bash toby $ exec su toby If I exit from it the…
Tomasz
  • 285
  • 1
  • 11
2
votes
2 answers

Setting environment variable during Docker container start (on AWS)

I am trying to pass a variable which fetches an IP address with the following code: ${wget -q -O - http://169.254.169.254/latest/meta-data/local-ipv4} I have tried setting an entrypoint shell script such as: #!/bin/sh export…
Lucas Gomez
  • 145
  • 1
  • 3
  • 12
2
votes
3 answers

How to run multiple commands on docker container on startup?

I have Flask application container which has to run on port 5000. I also have a background process which is related to queue. This process has an infinite loop which is why I want to run it in background. I'm using docker-compose.yml file for…
Underoos
  • 4,708
  • 8
  • 42
  • 85
2
votes
1 answer

Entrypoint's exec form executed through shell

I'm building a Windows based docker image: FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019 # omitted for brevity ENTRYPOINT ["c:\spinner.exe", "service", "w3svc", "-t", "c:\iislog\W3SVC\u_extend1.log"] The base image…
Amir Keibi
  • 1,991
  • 28
  • 45
1 2
3
11 12