0

I ran out of methods already, this is rather confusing.

So, I have a docker container where I would like to "git clone" my php web application, and then run "composer install".

From my understand, dockerfiles are best to keep them as flexible and generic as possible, so that's what I did.

I made 2 images:

  1. https://hub.docker.com/r/beamstyle/aws_docker_test-git/

    • This does a git clone on some repository via ENV variables.
  2. https://hub.docker.com/r/beamstyle/aws_docker_test-git-composer/

    • This inherits the Docker image from (1), then goes to the right directory and runs "composer install".

Am I correct?

If I run docker image (2), then I assume that everything declared in the Dockerfile in docker image (1) gets run, and then everything declared in the Dockerfile in docker image (2) gets run right after.

What I'm getting It seems like the commands in Dockerfile in image (1) is not being run. My directory is empty, and I'm getting an error in the Dockerfile in docker image (2), which says that a directory (which is supposed to be created from image (1)) does not exist.

This is my log for the container after doing "sudo docker logs 6fbf3b36c16a":

/usr/local/bin/run.sh: line 20: cd: ./_laravel: No such file or directory

What I want I hope to run the commands in Dockerfile in Docker image (1), and then in Docker image (2).

Thank you!

Thomas Cheng
  • 101
  • 1
  • It doesn't work this way. Actual container can have only one CMD and your second image overwrites first. – Navern Nov 01 '16 at 12:18
  • @Navern Thanks for your comment. Yeah I thought I might have misunderstood the concept. So if you were in my situation, as a best practice what would you do? "composer install" must be called after the "git clone" command finishes. – Thomas Cheng Nov 01 '16 at 14:58

0 Answers0