How to create a docker image by extending a docker image which was already created -
i creating docker image follows stage('build'){ agent any
steps{ script { dockerimage = docker.build("my_docker_image", "${my_args} .") } }
in jenkins file build stage
i want create new docker image based on image created additional configurations on build stage use in test stage.
is there way using dockerimage ?
you can reuse images in other dockerfile re-usability
let's assume have below dockerfile
from python:3.6 workdir /app copy ./server.py . cmd ["python", "server.py"]
now build using below
docker build -t production .
now let's assume want testing image should have telnet installed. instead of repeating dockerfile can start production
image present locally only
from production run apt update && apt install -y telnet
then build same using below
docker build -f dockerfile-testing -t testing .
as can see there no duplication of dockerfile content in this, want
Comments
Post a Comment