Hi there I want to install Metaphlan tool for metagenomic analysis in docker for that I have created an image and installed metaphlan in it using dockerfile. Than I run the container on first it properly printed the metaphlan command but its automatically stop sunning and exited. I don’t know why kindly help me out how to keep my container running and how to work in that container.
for dockerfile this was the content in it.
# Use the base Python image
FROM python:3.7
# Set the working directory inside the container
WORKDIR /app
# Install MetaPhlAn 3.1.0
RUN pip install metaphlan==3.1.0
# Set the entry point to MetaPhlAn
COPY entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT ["metaphlan"]
CMD tail -f /dev/null
it’s not clear how you are using this docker file to keep the container running.
could you please share more details steps with error.
I assumed and tried to reproduce like below.
docker file
#Use the base Python image
FROM python:3.7
#Set the working directory inside the container
WORKDIR /app
#Install MetaPhlAn 3.1.0
RUN pip install metaphlan==3.1.0
#Set the entry point to MetaPhlAn
#COPY entrypoint.sh /usr/local/bin/
#RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT ["metaphlan"]
CMD ["tail", "-f ", "/dev/null"]
@alishah730 pointed you to the right direction. Changing the CMD instruction to use the “exec form” was also a good idea, however the issue is still not resolved, as you need to understand what an entrypoint and a command is. A command is usually the argument of the entrypoint. Using the exec form the final command was become this:
metaphlan tail -f /dev/null
I don’t know metaphlan, but that it doesn’t seem like a wrapper to execute arguments as commands sou you can’t pass a shell command to it.
The original Dockerfile however must have had this result:
metaplan /bin/sh -c "tail -f /dev/tail"
which is still wrong.
If you want to use metaphlan, that has to be used without a command or used as a command without the entrypoint. You also need to make sure that metaphlan is running in the foreground, otherwise it will stop immediately. I could continue, but I wouldn’t write a whole tutorial here so let’s start understanding the entrypoint and the cmd If yalso hav a tutorial:
But the sourcecode doesn’t show the expeted result or explain anything, so you you don’t want to run the script, you can watch the video muted (it is Hungarian, but I am planning to translate it) but you can see what I am doing on the screen and what command has what result.