In order to pull from a private Docker Hub repo or push to one, you will need to login to docker. You will only need to do this once per session. There are 3 ways to do this, the first 2 of which are designed for being used in automation (CI):
Note: where env vars are specified before commands you could set these as permanent env vars on your machine.
DOCKER_USER=my_user DOCKER_PASS=my_pass make loginDOCKER_USER=my_user DOCKER_PASS_FILE=/my_docker_password.txt make loginwhere/my_docker_password.txtcontains your password. This method prevents your password being in your terminal history.docker login -u my_userThis method will prompt for your password on stdin.
This container runs php-fpm on port 9000.
If you need to make changes to the container, e.g. install a new php module:
- Make the required changes in
api.dockerfile - Run
make build-core-api. This command will create a local image reflecting your changes. - Start the container in development mode, see "Starting core-api container".
Otherwise if you are just testing code changes start the container in development mode, see "Start core-api container".
If you have not made changes to a container and you have previsouly ran the image in the mode you want, you can just start the existing container: docker start dp-core-api.
To get started you need to create a container from an image. For the core-api there are two ways to run a container:
- Development mode:
make run-core-api-dev. Local file changes will be reflected on the container. - Production mode:
make run-core-api-prod. Only configuration files will be reflected on the container.
Before running the container you should remove the existing dp-core-api container (if it exists - check with docker ps -a) with the command docker rm -f dp-core-api.
Once you have made code changes that you want to go live, you should build your image in production mode and push that container to docker hub.
- Git commit. You must do this first as the new image will be tagged with the git commit hash.
- Build the production image:
make build-core-api-prod. This will create an image with all of your code changes and tag it with the current git commit hash, andlatest. - See "Logging into docker"
- Push the new image to docker hub:
make push-core-api.
This container runs nginx on port 8080.
There core-api container should already be running before starting this container as it requires a link to core-api.
If you need to make changes to the container:
- Make the required changes in
web.dockerfileorconfig/vhost.conf - Run
make build-web. This command will create a local image reflecting your changes. - Start the container, see "Starting web container".
If you have not made changes to a container or you have previsouly ran the image in the mode you want, you can just start the existing container: docker start dp-core-api-web.
To get started you need to create a container from an image.
make run-web
Before running the container you should remove the existing dp-core-api-web container (if it exists - check with docker ps -a) with the command docker rm -f dp-core-api-web.
Once you have made changes to this container that you want to go live, you should push your image to docker hub.
- Git commit. You must do this first as the new image will be tagged with the git commit hash.
- Build the production image:
make build-web. This will create an image with all of your changes and tag it with the current git commit hash, andlatest. - See "Logging into docker"
- Push the new image to docker hub:
make push-web.