DockerFILE + Volumes + Httpd

I need help !!

docker run -idt -p 80:80 --name tenfive -v /mnt/code:/opt/code final
my directory got from host machine mounted after restarting docker service

Now i need to do this entire setup through docker file
how to go about that
Also, I need to use docker in production… PHP + APACHE + AWS RDS in autoscaling — suggestions ?

Also how do i add directory via docker file like i did with docker run -idt -p 80:80 --name tenfive -v /mnt/code:/opt/code final ??

You may want to use COPY or ADD in your Dockerfile to copy codes from your repository or the url (use ADD if you are using a URL).

If you need to mount the VOLUME, you can do that in Dockerfile as well, as specified in the docs. However, you cannot mount a volume from Host to Container using VOLUME in Dockerfile.

You may also be interested in Data Containers for the data persistence.

Hey sbasyal

docker run -idt -p 80:80 --name tenfive -v /mnt/code:/opt/code final & restarted docker service

with this i was able to mount the particular directory into my docker container … even if I make a make a file in this directory I am able to see the change in the host machine directory & vice versa…
this is through docker commands on shell…

The same thing i want to implement via docker file for consistency…
Wont this be the same VOLUME ["/mnt/code", “/opt/code”]

And what do you suggest for docker containers autoscaling ??

You cannot mount to host in Dockerfile. You can read why in here.

Wont this be the same VOLUME [“/mnt/code”, “/opt/code”]

So, this would not work as you expected.

That is why I think you might be interested in Data Containers.

And what do you suggest for docker containers autoscaling ??

You might want to look at Docker Compose and Docker Swarm for autoscaling.