This repository contains two C# web APIs served in single docker-compose file.
You can run this two APIs on docker on windows with windows environment varaibles: "windows.env".
You can run this two APIs on docker on Raspberry Pi with linux environment varaibles: "linux.env".
The README.md file contains commands that will allow you to:
- create images of your APIs depending on picked system and environment variables
- add the images to the docker hub platform
- download the images to the Linux (Raspberry Pi) / Windows
- run the all APIs containers on the Linux (Raspberry Pi) / Windows
http://localhost:5000
https://localhost:5001
http://localhost:5002
https://localhost:5003
dotnet dev-certs https --clean
dotnet dev-certs https -ep $HOME\.aspnet\https\aspnetapp.pfx -p password
dotnet dev-certs https --trust
-ep - path to existing certificate file (.pfx) that you want to use for HTTPS development (existing PFX file)
IMPORTANT - COPY CERTIFICATE TO RASPBERRY PI!!! (use scp) -> to: $HOME/.aspnet/https (change <raspberrypi_ip> to correct Raspberry Pi ip)
scp C:\Users\bartl\.aspnet\https\aspnetapp.pfx malinka@<raspberrypi_ip>:/home/malinka/Desktop
ssh malinka@<raspberrypi_ip>
sudo mv /home/malinka/Desktop/aspnetapp.pfx /home/malinka/.aspnet/https
docker-compose --env-file linux.env up -d --build
docker-compose --env-file windows.env up -d --build
--env-file - environment variables (other for different configuration / system)
-d - detached mode (services in the background, without blocking the command prompt)
--build - rebuild the docker images
docker-compose --env-file linux.env up -d
docker-compose --env-file windows.env up -d
docker-compose --env-file linux.env stop
docker-compose --env-file linux.env start
docker-compose --env-file windows.env stop
docker-compose --env-file windows.env start
docker-compose --env-file linux.env down
docker-compose --env-file windows.env down
docker-compose --env-file linux.env push
docker-compose --env-file windows.env push
sudo apt install docker-compose
- Copy "docker-compose.yml" file to Raspberry Pi (using scp)
- Copy "linux.env" file to Raspberry Pi (using scp)
scp C:\Users\bartl\source\repos\DockerComposeTest\docker-compose.yml malinka@<raspberrypi_ip>:/home/malinka/Desktop/
scp C:\Users\bartl\source\repos\DockerComposeTest\linux.env malinka@<raspberrypi_ip>:/home/malinka/Desktop/
docker-compose --env-file linux.env pull
docker-compose --env-file linux.env up -d
docker-compose --env-file windows.env pull
docker-compose --env-file windows.env up -d
docker images
docker ps -a
curl http://localhost:5000/api
curl -k https://localhost:5001/api
curl http://localhost:5002/api
curl -k https://localhost:5003/api
-k - ignore certificate check
docker pull fritzthecat9/dockercomposetest_api:LINUX
docker pull fritzthecat9/dockercomposetest_api2:LINUX
docker pull fritzthecat9/dockercomposetest_api:WINDOWS
docker pull fritzthecat9/dockercomposetest_api2:WINDOWS
docker logs container_name_or_id
-f - continuously follow or stream the logs generated by a Docker container
docker logs -f container_name_or_id