Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
202 views
in Technique[技术] by (71.8m points)

php - How can I overwrite a file through Dockerfile in docker container?

I have to overwrite a file through Dockerfile. In particular on an Ubuntu container with Apache and PHP and I have to overwrite the file php5-cgi.conf. I tried to use the following command:

COPY php5-cgi.conf /etc/apache2/conf-enabled/php5-cgi.conf

but I had the error: File already exists

I have also tried to use the following command

RUN cp -f php5-cgi.conf /etc/apache2/conf-enabled/

but the file is not copied when the container is running, Is there any advice on this?

question from:https://stackoverflow.com/questions/40895859/how-can-i-overwrite-a-file-through-dockerfile-in-docker-container

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Drop the file name from the destination:

COPY php5-cgi.conf /etc/apache2/conf-enabled/

The destination is an absolute path (not filename), or a path relative to the work directory, into which the source will be copied inside the destination container.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...