R
RunPod•7mo ago
Ryan

Pod Unable to Start Docker Container

I've tested this Docker image on my local computer and other servers, however on Runpod it seems to be stuck in a loop displaying "start container". Is this an issue others have encountered before?
No description
15 Replies
nerdylive
nerdylive•7mo ago
No, except your pods has a notice that it has any problems So it's should be a problem with your docker image May I see your dockerfile
Ryan
RyanOP•7mo ago
# Use the official Python image from the Docker Hub
FROM python:3.9-slim

# Set the working directory in the container
WORKDIR /app

# Install required packages
RUN pip install requests pytube tqdm youtube-search-python

# Copy the rest of the working directory contents into the container at /app
COPY . .

# Define environment variables for default parameters
ENV SERVER_URL="[REDACTED]"
ENV NUM_ITERATIONS=500
ENV NUM_THREADS=30
ENV NUM_INSTANCES=5

# Function to run the main script
CMD ["sh", "-c", "\
echo Starting container... && \
SERVER_URL=${SERVER_URL:-[REDACTED]} && \
NUM_ITERATIONS=${NUM_ITERATIONS:-25} && \
NUM_THREADS=${NUM_THREADS:-30} && \
NUM_INSTANCES=${NUM_INSTANCES:-5} && \
for i in $(seq 1 $NUM_INSTANCES); do \
echo Starting instance $i... && \
python [REDACTED].py $SERVER_URL $NUM_ITERATIONS --threads $NUM_THREADS & \
done && \
wait"]
# Use the official Python image from the Docker Hub
FROM python:3.9-slim

# Set the working directory in the container
WORKDIR /app

# Install required packages
RUN pip install requests pytube tqdm youtube-search-python

# Copy the rest of the working directory contents into the container at /app
COPY . .

# Define environment variables for default parameters
ENV SERVER_URL="[REDACTED]"
ENV NUM_ITERATIONS=500
ENV NUM_THREADS=30
ENV NUM_INSTANCES=5

# Function to run the main script
CMD ["sh", "-c", "\
echo Starting container... && \
SERVER_URL=${SERVER_URL:-[REDACTED]} && \
NUM_ITERATIONS=${NUM_ITERATIONS:-25} && \
NUM_THREADS=${NUM_THREADS:-30} && \
NUM_INSTANCES=${NUM_INSTANCES:-5} && \
for i in $(seq 1 $NUM_INSTANCES); do \
echo Starting instance $i... && \
python [REDACTED].py $SERVER_URL $NUM_ITERATIONS --threads $NUM_THREADS & \
done && \
wait"]
i appreciate the help!
nerdylive
nerdylive•7mo ago
Is server url accessible from the pod
Ryan
RyanOP•7mo ago
yep it should be
nerdylive
nerdylive•7mo ago
Maybe all the process has ended? What's wait for? Waiting all process to finish? Try to add more logging into your python file
Ryan
RyanOP•7mo ago
yeah ill give it a shot oh to note, this docker file is being specifed through templetes
Ryan
RyanOP•7mo ago
No description
nerdylive
nerdylive•7mo ago
Try using sleep infinity instead of wait if it keep restarting
Ryan
RyanOP•7mo ago
its my understanding that the container start command is not requred if there's a dockerfile present?
nerdylive
nerdylive•7mo ago
Yes It adds using cmd only
Ryan
RyanOP•7mo ago
hmmm i think runpod may actully not be the best choice, due to other circumstances on second thought ill come back to this thread if things change, but thanks for the help!
nerdylive
nerdylive•7mo ago
Alright
Madiator2011
Madiator2011•7mo ago
I would save it as sh script and bake into container then set CMD command to start sh script
justin
justin•7mo ago
https://github.com/justinwlin/Runpod-GPU-And-Serverless-Base If you want an easy way to launch, I'd say just add your requirements here. But there multiple stuff going on mainly that you need to have more stuff than just a basic python docker container. But gl with whatever other solution you end up using! 🙂 It does seem like just looking at your requirements and guessing, you basically prob want to use a cpu pod serverless, to do some yt stuff
haris
haris•7mo ago
Would love to hear what your use case is and why we might not be the best choice
Want results from more Discord servers?
Add your server