Building my own Docker image from officiall WordPress image

  docker, php, volumes, wordpress

I’m trying to build my own image based on image from Docker Hub
What I want to do is to add some new files to existing file system on image
I created Dockerfile with the following content:

from wordpress

copy . /var/www/html/wp-content/plugins

Here I’m trying to fetch official wordpress image and then copy some files in my current directory to plugins folder. Then I built the image and got new image lets call it newimage. Then I’m trying to run container based on this newimage and also I want to use volume for this contatiner to store data on my host machine. I’m doing this command:

docker run -d –name wp -v wp-volume:/var/www/html newimage

The container starts well but when I’m trying to check the folder var/www/html/wp-content/plugins I can’t see the files that was copied on stage of building this image. But if I do the command:
docker run -d –name wp newimage
without using a volume I can see the files that was copied in the path /var/www/html/wp-content/plugins
so why if i run container WITH volume I can’t see my files but If I run container WITHOUT volume I can see my files in /var/www/html/wp-content/plugins

Source: Docker Questions