Based on a howto, i created a new image based on an existing one.
now i don´t have a Dockerfile and there are things happening, when the container starts
I cannot change - that´s how it looks to me.
Is there a way to modify things that have been setup in the Dockerfile of the base image I have used ?
for example: the container runs a bash script when it starts, i want to change this.
now i don´t have a Dockerfile and there are things happening, when the container starts
I cannot change - that´s how it looks to me.
Is there a way to modify things that have been setup in the Dockerfile of the base image I have used ?
for example: the container runs a bash script when it starts, i want to change this.
----------------
To answer your specific q: "the container runs a bash script when it starts, i want to change this". Let's assume you want to run
/script.sh
(part of the image) instead of the default, you can instantiate a container using:docker run --entrypoint /script.sh repo/image
If script.sh
isn't part of the image and/or you prefer not having to specify it explicitly each time with --entrypoint
as above, you can prepare an image that contains and runs your own script.sh
:- Create an empty directory and copy or create
script.sh
in it - Create
Dockerfile
with following content:
FROM repo/image
ADD script.sh /
ENTRYPOINT /script.sh docker build -t="myimage" .
docker run myimage
- When running the container (step 4), it's no longer necessary to specify
--entrypoint
since we have it defaulted in theDockerfile
. - It's really that simple; no need to sign up to docker hub or any such thing (although it's of course recommended in time ;-)
No comments:
Post a Comment