Docker Dot Net Notes

1. Publish to Docker Repository

1.1. Initial Setup

1.1.1. Don’t do this

Do not add Docker Support to the project!
It is not necessary and doesn’t work properly anyway.

1.1.2. Create a Publishing Profile

  1. Right mouse click on the Project and select the Publish…​ menu item.

  2. Click the Add a publish profile link.

  3. Select the Docker Container Registry Target and click Next.

  4. Select the Other Docker Container Registry Target and click Next.

  5. Set Target Registry URL=

    https://docker.repo.xackleystudio.com
  6. Provide credentials and click Next

  7. Select .NET SDK for Container build and click Finish

  8. Click Close

1.1.3. Create a Docker Compose File

  1. Create a docker compose.yml file like the following:

    version: '3.5'
    services:
    
      kestrel-my-site:
        container_name: My-Site
        image: 'docker.repo.xackleystudio.com/my-docker-image:latest'
        ports:
          - '8932:80'
        environment:
          - TZ=America/New_York
          - PUID=1000
          - PGID=1000
        volumes:
          - ./My-Site-data/logs:/app/logs
        restart: unless-stopped

1.2. Publish

  1. After the Publishing Profile has been created, click the Publish button to publish.

2. Updates

2.1. Code

  1. Update and test code as per usual.

  2. Publish via the already created profile.

2.2. Docker

  1. Over on the Docker host server, update the image via:

    sudo docker-compose pull
  2. Now restart the container via:

    sudo docker-compose up -d
  3. You can optionally remove older images via:

    sudo docker image prune -a

3. Troubleshooting

3.1. Web Sites

3.1.1. Rendering Issues

If the site fails to render it may be missing the .js file.