This document contains information on how to build and upload the docker image.
- Install Git
- Install Amazon AWS CLI
- Install Docker Toolbox
- If you want to move the image of virtual machine:
- Add the environment variable
MACHINE_STORAGE_PATH
with valueD:\Docker\machine
for example
- Add the environment variable
- If your workspace isn't in the path
C:\Users
:- Launch the Docker Quickstart Terminal for the first initialization
- Close the terminal and shutdown the VM in Virtualbox
- In Virtualbox, add the shared folder:
D:\Www
tod/Wwww
with the automatic mounting
- Close Virtualbox
- Clone the repository
git@github.com:klipperdev/docker-app-server.git
with Git - Launch the Docker Quickstart Terminal
- Move the working directory in the folder of this repository (ex.
cd /d/Git/docker/klipper/docker-app-server
) - Create the docker image *:
docker build -t <ecr-repository> .
- Get the docker login for the Amazon AWS ECR *:
aws ecr get-login --no-include-email --region <ecr-region>
- Run the docker login command that was returned in the previous step *
- Tag the docker image *:
docker tag <ecr-repository>:latest <ecr-repository-uri>:latest
- Push the docker image in the Amazon AWS ECR *:
docker push <ecr-repository-uri>:latest
Notes:
- * All commands are listed in the selected ECR repository of the Amazon AWS Console (button
Display push commands
)<ecr-region>
must be replaced by the name of the selected region of ECR repository (defined in the URI of the ECR repository)<ecr-repository>
must be replaced by the name of the selected ECR repository<ecr-repository-uri>
must be replaced by the URI of the selected ECR repository
Use the image directly in the docker compose file:
# docker-compose.yml
version: '3.2'
services:
app:
container_name: app
working_dir: /var/www/html
image: <ecr-repository-uri>:latest
volumes:
- .:/var/www/html
Or with the Dockerfile:
# ./docker-compose.yml
version: '3.2'
services:
app:
container_name: app
working_dir: /var/www/html
build:
context: .
dockerfile: docker/app/Dockerfile
volumes:
- .:/var/www/html
# ./docker/back/Dockerfile
FROM <ecr-repository-uri>:latest
# Your dockerfile actions
Notes:
<ecr-repository-uri>
must be replaced by the URI of the selected ECR repository