Reputation: 897
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 am not able to understand what is happening? Any help would be appreciated to this newcomer
Thankyou.
Upvotes: 0
Views: 1801
Reputation: 1058
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
Upvotes: 1