Is running Testing script using override Entrypoint an antipattern in Docker?

  docker, docker-machine

I have a following Dockerfile

FROM python:3.6

WORKDIR /app
 
ADD main.py /app

ENTRYPOINT [ "python3",  "main.py" ]

I have a prerequisite test that runs before deployment that verifies connection, input files, etc

So I added testing script to Docker image like

FROM python:3.6

WORKDIR /app
 
ADD main.py /app
ADD test.py /app

ENTRYPOINT [ "python3",  "main.py" ]

For testing, I am running docker container like

docker run --entrypoint python3 myImage test.py 

Is this an anti pattern in Docker? Would it be better practice to create separate Testing container image?

Source: Docker Questions

LEAVE A COMMENT