Run Artifactory behind Traefik with LetsEncrypt using docker-compose

Create Docker network:

docker network create container-network
Create a password for traefic. For this we will use apache-urils:
apt install apache2-utils -y
Generate password hash - enter secret-password twice:
htpasswd -nBC 10 "" | tr -d ':\n'; echo
Save the output somewhere:
$2y$10$fE2ziWd4hs9NfxbN7PZBTeGtZwQj37B0SHaquix0PIdgWT9vZun4S
Create traefic/docker-compose.yaml:
version: '3.3'
services:
  traefik:
    # The official v2 Traefik docker image
    image: "traefik:v2.2"
    container_name: "traefik"
    # Enables the web UI and tells Traefik to listen to docker
    command:
      - "--api=true"
      - "--api.dashboard=true"
      - "--log.level=DEBUG"
      - "--accesslog=true"
      - "--accesslog.filePath=/logs/access.log"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--providers.docker.network=container-network"
      - "--entrypoints.web.http.redirections.entrypoint.to=websecure"
      - "--entrypoints.web.http.redirections.entrypoint.scheme=https"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.myresolver.acme.httpchallenge=true"
      - "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
      - "--certificatesresolvers.myresolver.acme.email=telinovdima@gmail.com"
      - "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
    networks:
      - container-network
    ports:
       - "80:80"
       - "443:443"
    volumes:
      - "./logs:/logs"
      - "./letsencrypt:/letsencrypt"
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.api.rule=Host(`traefik.qwerty.md`)"
      - "traefik.http.routers.api.service=api@internal"
      - "traefik.http.routers.api.middlewares=auth"
      - "traefik.http.middlewares.auth.basicauth.users=admin:$2y$10$fE2ziWd4hs9NfxbN7PZBTeGtZwQj37B0SHaquix0PIdgWT9vZun4S" # put here your generated hash in previous step
      - "traefik.http.routers.api.entrypoints=websecure"
      - "traefik.http.routers.api.tls.certresolver=myresolver"
networks:
  container-network:
    external: true
Run the container:
cd traefic
docker-compose up -d
Create artifactory/docker-compose.yaml:
version: '3'
services:
  artifactory:
    image: docker.bintray.io/jfrog/artifactory-oss:latest
    environment:
      - ARTIFACTORY_HOME=/var/opt/jfrog/artifactory
    volumes:
      - "artifactory_data:/var/opt/jfrog/artifactory"
    ports:
       - "8081:8081"
       - "8082:8082"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.artifactory.rule=Host(`artf.qwerty.md`)"
      - "traefik.http.routers.artifactory.tls=true"
      - "traefik.http.routers.artifactory.entrypoints=websecure"
      - "traefik.http.services.artifactory.loadbalancer.server.port=8081"
      - "traefik.http.services.artifactory.loadbalancer.server.port=8082"
      - "traefik.http.routers.artifactory.tls.certresolver=myresolver"
    networks:
      - container-network
    restart: unless-stopped

volumes:
  artifactory_data:

networks:
  container-network:
    external: true
Run the container:
cd artifactory
docker-compose up -d
Access your configured domain. In my case it is:
https://artf.qwerty.md
As you can observe, letsencrypt is configured already and certificate is valid. Artifactory behind the traefik runs fine.