{"id":1499,"date":"2021-03-19T13:07:55","date_gmt":"2021-03-19T13:07:55","guid":{"rendered":"https:\/\/dft.wiki\/?p=1499"},"modified":"2026-06-08T23:18:42","modified_gmt":"2026-06-09T03:18:42","slug":"yacht-to-manage-dockers-containers","status":"publish","type":"post","link":"https:\/\/dft.wiki\/?p=1499","title":{"rendered":"Managing Dockers Containers with Yacht over HTTPS"},"content":{"rendered":"<p>Yacht is a web GUI to manage Docker containers, making deployment and management of resources easy [<a href=\"https:\/\/yacht.sh\/\">Link<\/a>].<\/p>\n<p>See also the post about Portainer [<a href=\"https:\/\/dft.wiki\/?p=1509\">Link<\/a>].<\/p>\n<p>See also the post about CasaOS [<a href=\"https:\/\/dft.wiki\/?p=3836\">Link<\/a>].<\/p>\n<p>Installation:<\/p>\n<pre>sudo apt update\r\nsudo apt install <strong>docker.io<\/strong>\r\nsudo docker <strong>volume create yacht-fs<\/strong>\r\nsudo docker run -d --name <strong>yacht<\/strong> -p <strong>8000<\/strong>:8000 -v \/var\/run\/docker.sock:\/var\/run\/docker.sock -v <strong>yacht-fs<\/strong>:\/config selfhostedpro\/yacht<\/pre>\n<p>Navigate to <strong>http:\/\/127.0.0.1:8000\/<\/strong> in your browser and log in with the default credentials: <strong>admin@yacht.local<\/strong> and <strong>pass<\/strong>.<\/p>\n<p>Immediately change the default password and add the following template:<\/p>\n<pre>https:\/\/raw.githubusercontent.com\/SelfhostedPro\/selfhosted_templates\/yacht\/Template\/template.json<\/pre>\n<p>This template lists many applications that can be deployed with a single click or customized.<\/p>\n<p>Using SSL\/TLS is highly recommended when accessing Yacht over a local network, and essential when accessing it remotely over the internet.<\/p>\n<p>On a host machine running Ubuntu 20.04, install:<\/p>\n<pre>sudo apt install nginx\r\nsudo apt install certbot\r\nsudo apt-get install python3-certbot-nginx<\/pre>\n<p>For older versions of Ubuntu:<\/p>\n<pre>sudo apt-get install python-certbot-nginx<\/pre>\n<p>It is good practice to replace or clear the default webpage located at <strong>\/var\/www\/html\/<\/strong>.<\/p>\n<p>Edit the site configuration at <strong>\/etc\/nginx\/sites-available\/default<\/strong> and set the domain name as shown below:<\/p>\n<pre>...\r\nserver_name <strong>example.com<\/strong>;\r\n...<\/pre>\n<p>Test and restart NGINX, then run Certbot:<\/p>\n<pre>sudo nginx -t &amp;&amp; sudo nginx -s reload\r\nsudo certbot --nginx -d <strong>example.com<\/strong><\/pre>\n<p>Follow the prompts and choose to redirect all HTTP traffic to HTTPS.<\/p>\n<p>Back in the browser, navigate to <strong>https:\/\/example.com<\/strong> (replace with your actual domain).<\/p>\n<p>To ensure the certificate renews automatically, add the following line to the root <strong>crontab -e<\/strong> on the host machine:<\/p>\n<pre>0 0 * * * \/usr\/bin\/certbot renew --quiet<\/pre>\n<p>This command will attempt renewal once a week.<\/p>\n<p>Stop and remove the container, then run it again with the certificate folder mounted:<\/p>\n<pre>sudo docker stop <strong>yacht<\/strong>\r\nsudo docker rm <strong>yacht<\/strong>\r\ndocker run -d --name yacht -p 8000:<strong>443<\/strong> -v \/var\/run\/docker.sock:\/var\/run\/docker.sock <strong>-v \/etc\/letsencrypt\/:\/etc\/letsencrypt\/<\/strong> -v yacht-fs:\/config selfhostedpro\/yacht<\/pre>\n<p>Any previous configuration is preserved in the volume created earlier.<\/p>\n<p>Open a shell inside the container:<\/p>\n<pre>sudo docker exec -it <strong>yacht<\/strong> \/bin\/bash<\/pre>\n<p>Edit the NGINX configuration file at <strong>\/etc\/nginx\/nginx.conf<\/strong> and add the following <strong>bolded<\/strong> lines, replacing <strong><span style=\"color: #ff0000;\">example.com<\/span><\/strong> with your domain:<\/p>\n<pre><span style=\"color: #808080;\">worker_processes 1;\r\n\r\nuser abc abc;\r\nerror_log \/var\/log\/nginx\/error.log warn;\r\npid \/var\/run\/nginx.pid;\r\n\r\nevents {\r\n    worker_connections 1024;\r\n}\r\n\r\nhttp {\r\n    include \/etc\/nginx\/mime.types;\r\n    ### Set http options\r\n    # fallback in case we can't determine a type\r\n    default_type application\/octet-stream;\r\n    access_log \/var\/log\/nginx\/access.log combined;\r\n    sendfile on;\r\n    keepalive_timeout 5;\r\n\r\n    map $http_upgrade $connection_upgrade {\r\n        default upgrade;\r\n        '' close;\r\n    }<\/span>\r\n\r\n<strong>    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE\r\n    ssl_prefer_server_ciphers on;\r\n<\/strong>\r\n<span style=\"color: #808080;\">    upstream api_server {\r\n        server unix:\/tmp\/gunicorn.sock fail_timeout=0;\r\n    }\r\n\r\n    # Paths for Vue and FastAPI\r\n    server {\r\n        listen *:8000;\r\n\r\n        # Vue\r\n        location \/ {\r\n            root \/app;\r\n            index index.html;\r\n            try_files $uri $uri\/ \/index.html;\r\n        }\r\n        error_page 500 502 503 504 \/50x.html;\r\n\r\n        server_name dfttest.duckdns.org;<\/span>\r\n\r\n<strong>        listen [::]:443 ssl ipv6only=on;\r\n        listen 443 ssl;\r\n        ssl_certificate \/etc\/letsencrypt\/live\/<span style=\"color: #ff0000;\">example.com<\/span>\/fullchain.pem;\r\n        ssl_certificate_key \/etc\/letsencrypt\/live\/<span style=\"color: #ff0000;\">example.com<\/span>\/privkey.pem;\r\n        include \/etc\/letsencrypt\/options-ssl-nginx.conf;\r\n        ssl_dhparam \/etc\/letsencrypt\/ssl-dhparams.pem;\r\n<\/strong>\r\n<span style=\"color: #808080;\">   location = \/50x.html {\r\n            root \/usr\/share\/nginx\/html;\r\n        }\r\n\r\n        # FastAPI\r\n        location \/api\/ {\r\n            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\r\n            proxy_set_header X-Forwarded-Proto $scheme;\r\n            proxy_set_header Host $http_host;\r\n            # Set this so that the app updates function doesn't timeout\r\n            \r\n            proxy_read_timeout 300s;\r\n            proxy_http_version 1.1;\r\n            proxy_set_header Upgrade $http_upgrade;\r\n            proxy_set_header Connection \"Upgrade\";\r\n\r\n            client_body_temp_path \/var\/www\/client_body_temp;\r\n            proxy_temp_path \/var\/www\/proxy_temp;\r\n            # we don't want nginx trying to do something clever with\r\n            # redirects, we set the Host: header above already.\r\n            proxy_redirect off;\r\n            proxy_pass http:\/\/api_server\/;\r\n        }\r\n    }\r\n}<\/span><\/pre>\n<p>Test the configuration and reload the service:<\/p>\n<pre>sudo nginx -t &amp;&amp; sudo nginx -s reload<\/pre>\n<p>Test access again in your browser using http<strong>S<\/strong>:\/\/example.com:8000<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yacht is a web GUI to manage Docker containers, making deployment and management of resources [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,6],"tags":[],"class_list":["post-1499","post","type-post","status-publish","format-standard","hentry","category-linux","category-raspberry-pi"],"_links":{"self":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/1499","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1499"}],"version-history":[{"count":12,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/1499\/revisions"}],"predecessor-version":[{"id":5759,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/1499\/revisions\/5759"}],"wp:attachment":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1499"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}