Docker compose
- Docker compose is a tool for defining and running multi container Docker applications
- Docker compose is written as a yaml file and Refer Here for the yaml file reference
- create a yaml file as shown below
---
version: "3.8"
services:
web:
build: .
ports:
- 8080:8080
database:
image: mysql
environment:
MYSQL_ROOT_PASSWORD: directdevops
MYSQL_DATABASE: test
MYSQL_USER: directdevops
MYSQL_PASSWORD: directdevops
volumes:
- type: volume
source: db_data
target: /var/lib/mysql
volumes:
db_data: {}
- Now docker-compose up -d will create images and start all the containers & docker-compose down will remove all the containers started.
Docker on Windows
- From Windows 10 and Windows Server 2016 microsoft has added the support for running docker container natively on windows, prior to that on windows container were created using hypervisors (virtual box/hyperv)
- On Windows Systems, We can run docker containers with windows images as well as linux images,
- Windows containers cannot be run on the linux nodes
- Create a Windows Server and Enable the windows feature
Containers- Launch Powershell as Admin and Execute
Install-WindowsFeature -Name Containers UnInstall-WindowsFeature Windows-Defender Restart-Computer -Force - Install Docker on Windows Server 2019 Refer Here
- Launch Powershell as Admin and Execute
Install-Module -Name DockerMsftProvider -Repository PSGallery -Force Install-Package -Name docker -ProviderName DockerMsftProvider Restart-Computer -Force- Login into the machine Launch Powershell as Admin again
Start-Service Docker- pull some of the windows base images Refer Here
docker pull mcr.microsoft.com/windows/servercore:ltsc2019- Lets quickly write one docker file to enable iis server with some html page using the above as base image
FROM mcr.microsoft.com/windows/servercore:ltsc2019
LABEL maintainer='khaja'
RUN dism.exe /online /enable-feature /all /featurename:iis-webserver /NoRestart
RUN echo "Hello World - Windows Container" > c:\inetpub\wwwroot\index.html
CMD ["cmd"]
- To deploy an iis application use https://hub.docker.com/_/microsoft-windows-servercore-iis
- Refer Here to add windows node to the k8s cluster
- Refer Here to add windows node to Azure AKS
- Refer Here for window support on AWS EKS
