Docker run as build step
Answered
Hello, I'm a beginner in docker, as well as in team city, I set up a pipeline for a build of a docker container and wanted to configure it to run after a successful build, I tried to use a step with a docker, but they advise using the command line with executable parameters, I crossed the Internet / YouTube did not see normal examples for starting a container after a build. I saw some examples of launching with agents, but again I did not understand anything in what was written, I looked for examples on YouTube, I also did not find it. Please give an example of running docker as a step in the pipeline on Linux.
Please sign in to leave a comment.
Hi! I am not sure I fully understand your use case, but adding a Command Line build step with this command will run the hello-world image on the same host as the build agent:
That image is trivial and only produces some output and exits so you probably won't need other parameters in the command. Your actual image might need to be run in some specific way so it would make sense to contact the image developer if you are not sure how to run it.
For more options and examples of the docker run command you can look through this reference:
https://docs.docker.com/engine/reference/run
If that isn't what you were looking for, please expand on your use case by stating what exactly you are trying to achieve, how do you want to start your container, and on which host.
Cheers,
Anatoly