0

I am new to Docker Concept , I just started today playing with it . And I found out the exec command whose job is to run a new command in a running container.

I am inside ~/linux-tweet-app directory which contains index-original.html and index.html files. My container is running :

 docker container run \
 --detach \
 --publish 80:80 \
 --name linux_tweet_app \
 --mount type=bind,source="$(pwd)",target=/usr/share/nginx/html \
 $DOCKERID/linux_tweet_app:1.0

My task is to copy index-original.html content to index.html . As i am using bind mount on docker host so, this works:

 cp index-new.html index.html

and the changes got reflected ,

But while doing so with exec:

docker exec -it linux_tweet_app cp index-original.html index.html

I got the following error : enter image description here

I am not able to understand what is happening? Any help would be appreciated to this newcomer

Thankyou.

1 Answer 1

1

It's because you need to use full path inside container, so this should work:

docker exec -it linux_tweet_app cp /usr/share/nginx/html/index-original.html /usr/share/nginx/html/index.html

You may also specify WORKDIR in Dockerfile and set it to /usr/share/nginx/html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.