diff --git a/Source/.dockerignore b/Source/.dockerignore
new file mode 100644
index 0000000..9d3e851
--- /dev/null
+++ b/Source/.dockerignore
@@ -0,0 +1,5 @@
+**/bin/*
+**/obj/*
+**/out/*
+**/.vs/*
+**/_ReSharper.Caches/*
\ No newline at end of file
diff --git a/Source/Api/Api.csproj b/Source/Api/Api.csproj
index ebd6551..9d5c5f8 100644
--- a/Source/Api/Api.csproj
+++ b/Source/Api/Api.csproj
@@ -33,4 +33,12 @@
+
+
+
+ PreserveNewest
+ true
+ PreserveNewest
+
+
diff --git a/Source/Api/README.md b/Source/Api/README.md
index 9a11447..9871c89 100644
--- a/Source/Api/README.md
+++ b/Source/Api/README.md
@@ -1,5 +1,5 @@
-**Prequisites**
+# Prequisites
Requires ZFS installed on the server
@@ -37,3 +37,29 @@ cd /mnt/zfsapi/zfsapi
tr -d '\r' < /mnt/zfsapi/zfsapi/1.2.3/deploy.sh > /mnt/zfsapi/zfsapi/deploy.sh
sudo sh /mnt/zfsapi/zfsapi/deploy.sh 1.2.3 all
+
+# Docker
+
+You can also run the api in a docker container
+
+## SSH keys
+Before building the docker image you need to ensure that whatever private/public key you want to use for ssh connections to the zfs server is present in the directory where the Dockerfile is located.
+
+So before building, copy the keys to the same directory as the Dockerfile
+
+## Building the image
+
+Simply open a shell/powershell/cmd whatever up on the Source folder and run the following command to build the image
+
+```bash
+cd Source
+docker build -t zfs-api:1.1.10 -f './Dockerfile' --build-arg="SSH_PRIVATE_KEY=id_rsa" --build-arg="SSH_PUBLIC_KEY=id_rsa.pub" .
+```
+
+Please note that ssh keys needs to be installed into the docker container, so its possible to run passwordless ssh to the server that runs the zfs filesystem.
+
+The ssh keys needs to be present in the same directory as the `Dockerfile` or else the docker build process will not be able to find them, since the docker build process cannot reach file from outside of the root of the build process which is the location of the `Dockerfile`
+
+## Running the docker container
+After having built the image, simply do a:
+`docker run zfs-api:1.1.10 -p 5000:5000`
diff --git a/Source/Api/appsettings.Docker.json b/Source/Api/appsettings.Docker.json
new file mode 100644
index 0000000..bca2f1c
--- /dev/null
+++ b/Source/Api/appsettings.Docker.json
@@ -0,0 +1,17 @@
+{
+ "Remote": {
+ "UseRemoteConnection": true,
+ "HostName": "zfsdev.root.dom",
+ "UserName": "bbs",
+ "UseSudo": true
+ },
+ "Logging": {
+ "LogLevel": {
+ "Default": "Trace",
+ "Microsoft": "Warning",
+ "Microsoft.Hosting.Lifetime": "Information"
+ }
+ },
+ "AllowedHosts": "*",
+ "UseLinuxAuth": false
+}
\ No newline at end of file
diff --git a/Source/Dockerfile b/Source/Dockerfile
new file mode 100644
index 0000000..04b9fd4
--- /dev/null
+++ b/Source/Dockerfile
@@ -0,0 +1,55 @@
+# create build environment in /Build
+FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
+WORKDIR /Build
+
+# Copy source files
+COPY ./Api/* ./Api/
+
+# Build and publish to /Build/out
+RUN dotnet build Api/Api.csproj -c Release --framework net6.0 --runtime linux-x64
+
+RUN dotnet publish Api/Api.csproj --no-build -c Release --framework net6.0 --sc --runtime linux-x64 -o out
+CMD ls -l
+FROM mcr.microsoft.com/dotnet/aspnet:8.0
+
+# install required packages
+run apt-get update && apt-get -y install libpam0g-dev ssh
+
+# Create app dir /App and copy publishing output to /App
+WORKDIR /App
+COPY --from=build-env /Build/out .
+
+# create user to run our app
+RUN groupadd -g 10001 dotnet && \
+ useradd -u 10000 -g dotnet dotnet -rmd /home/dotnet \
+ && chown -R dotnet:dotnet /App
+
+ARG SSH_PRIVATE_KEY=id_rsa
+ARG SSH_PUBLIC_KEY=id_rsa.pub
+
+# copy ssh keys from build arguments
+RUN mkdir -p /home/dotnet/.ssh
+COPY ${SSH_PRIVATE_KEY} /home/dotnet/.ssh/id_rsa
+COPY ${SSH_PUBLIC_KEY} /home/dotnet/.ssh/id_rsa.pub
+
+# Make dotnet user owner of everything below /home/dotnet and set correct ssh permisssions on files
+RUN chown -R dotnet:dotnet /home/dotnet && chmod 700 /home/dotnet/.ssh && chmod 644 /home/dotnet/.ssh/id_rsa.pub && chmod 600 /home/dotnet/.ssh/id_rsa
+
+# Allow docker image to connect to new ssh servers servers without prompting for a ssh key
+RUN touch /etc/ssh/ssh_config.d/zfs-api.conf && echo "StrictHostKeyChecking accept-new" >> /etc/ssh/ssh_config.d/zfs-api.conf
+
+MAINTAINER Bjorn Smith
+LABEL maintainer="Bjorn Smith "
+LABEL version="1.1.10"
+LABEL description="A .NET REST API that allows you to inspect and manipulate the zfs file system \
+ \
+See github repository for more information and source code: https://github.com/bjornbouetsmith/ROOT.Zfs.Api"
+
+# run as the dotnet user
+USER dotnet:dotnet
+
+# Tell docker we will be exposing port 5000
+EXPOSE 5000/TCP
+
+# run the api in the asp.net environment Docker, which corresponds to the appsettings.Docker.json
+ENTRYPOINT ["dotnet","Api.dll","--environment=Docker"]
\ No newline at end of file
diff --git a/Source/ROOT.Zfs.Api.sln b/Source/ROOT.Zfs.Api.sln
index 53670a3..9982102 100644
--- a/Source/ROOT.Zfs.Api.sln
+++ b/Source/ROOT.Zfs.Api.sln
@@ -13,6 +13,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Github", "Github", "{BEDD26
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4912DE71-350A-4036-B203-CC7A1CFD3513}"
ProjectSection(SolutionItems) = preProject
+ .dockerignore = .dockerignore
+ Dockerfile = Dockerfile
..\README.md = ..\README.md
EndProjectSection
EndProject