Getting Started with an App


We create an application and realize we need a lot of help to run it within containers.

We need an application to "dockerize". In this video, we'll grab the shippingdocker.com repository and quickly see that we need a Docker image to run our application container(s) from.

git clone <ssh-repo-uri>
cd shippingdocker.com
ls -lah

We can try to run it with PHP's built in server:

php -S 0.0.0.0:8888 -t ./public

We get errors because we haven't run composer to get our dependencies. However the PHP on my computer is the wrong version. I could use an image from Docker hub to run a container which has PHP and composer:

docker run -it --rm \
    -v $(pwd):/opt \
    -w /opt \
    shippingdocker/php \
    composer install

This command:

  • run's a new container (removing it via --rm when it's finished running)
  • Mounts the current directory ($(pwd)) to the /opt directory in the container
  • Set's the container's working directory (-w) to /opt (so the current directory is the one containing our code)
  • Uses the shippingdocker/php container built in other video series and hosted at Docker Hub
  • Runs composer install from within the container

However, I want to first build an image specific for our project, which we'll do in the next video. This image will container all of our PHP dependenciess needed for the shippingdocker.com site.