{"id":831,"date":"2024-04-21T21:48:33","date_gmt":"2024-04-21T21:48:33","guid":{"rendered":"https:\/\/techtutelage.net\/?p=831"},"modified":"2025-05-18T05:05:17","modified_gmt":"2025-05-18T05:05:17","slug":"how-to-set-up-matrix-synapse-server-with-docker","status":"publish","type":"post","link":"https:\/\/techtutelage.net\/?p=831","title":{"rendered":"How to Set Up Matrix\/Synapse Server with Docker"},"content":{"rendered":"\n<iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/_hFDgGKNa54?si=wFqMdDRdwaCqWK0t\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n\n\n\n<pre class=\"wp-block-code has-white-color has-vivid-red-background-color has-text-color has-background has-link-color wp-elements-88c4d7a30d165c020fd3f36eecd70a73\"><code>WARNING: Please note that this guide is a summary of the commands used in the video tutorial. It's not a step-by-step tutorial itself. For detailed instructions, please refer to the video tutorial. <\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Install Docker<\/h2>\n\n\n\n<p>Add Docker&#8217;s official GPG key:<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-green-cyan-color has-black-background-color has-text-color has-background has-link-color wp-elements-6940c465e3b70dbee3d60aad93e940e1\"><code>apt-get update\napt-get install ca-certificates curl\ninstall -m 0755 -d \/etc\/apt\/keyrings\ncurl -fsSL https:\/\/download.docker.com\/linux\/ubuntu\/gpg -o \/etc\/apt\/keyrings\/docker.asc\nchmod a+r \/etc\/apt\/keyrings\/docker.asc<\/code><\/pre>\n\n\n\n<p>Add Docker repository to apt sources:<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-green-cyan-color has-black-background-color has-text-color has-background has-link-color wp-elements-cc56d4656e1cc615cb49137eeaa44130\"><code>echo \\\n  \"deb &#91;arch=$(dpkg --print-architecture) signed-by=\/etc\/apt\/keyrings\/docker.asc] https:\/\/download.docker.com\/linux\/ubuntu \\\n  $(. \/etc\/os-release &amp;&amp; echo \"$VERSION_CODENAME\") stable\" | \\\n  tee \/etc\/apt\/sources.list.d\/docker.list > \/dev\/null\napt-get update<\/code><\/pre>\n\n\n\n<p>Install Docker and other required packages:<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-green-cyan-color has-black-background-color has-text-color has-background has-link-color wp-elements-aa7ec81b596742d9517674c740e497d7\"><code>apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose docker-compose-plugin nano<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Install Matrix with Docker<\/h2>\n\n\n\n<p>Create\u00a0 docker-compose.yml<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-green-cyan-color has-black-background-color has-text-color has-background has-link-color wp-elements-29aaea1e4e6024563065e13d70bc2540\"><code>nano docker-compose.yml<\/code><\/pre>\n\n\n\n<p>Paste the lines below in the docker-compose.yml<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-green-cyan-color has-black-background-color has-text-color has-background has-link-color wp-elements-90b071e2b6df9a0c97b2bf66035b795d\"><code>version: '3'\n\nservices:\n  matrix:\n    image: matrixdotorg\/synapse:latest\n    ports:\n      - \"8008:8008\"\n      - \"8448:8448\"\n    volumes:\n      - .\/data:\/data\n    environment:\n      - SYNAPSE_SERVER_NAME=&lt;REPLACE.WITH.YOUR_DOMAIN_NAME>\n      - SYNAPSE_REPORT_STATS=no\n    restart: always<\/code><\/pre>\n\n\n\n<p>Generate Matrix container configuration<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-green-cyan-color has-black-background-color has-text-color has-background has-link-color wp-elements-9f606f30cfd49a04770c3ee1c73fadd6\"><code>docker-compose run --rm matrix generate<\/code><\/pre>\n\n\n\n<p>Edit the homeserver.yml file in data directory and add the following configuration for TLS and registration:<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-green-cyan-color has-black-background-color has-text-color has-background has-link-color wp-elements-3694ffb9668fe82ff54816c3c4f0fe5a\"><code>  - port: 8448\n    tls: true\n    type: http\n    x_forwarded: true\n    resources:\n      - names: &#91;client, federation]\n        compress: false\n\ntls_certificate_path: \"\/data\/cert.pem\"  \ntls_private_key_path: \"\/data\/key.pem\"\n\nenable_registration: true\nenable_registration_without_verification: true\n<\/code><\/pre>\n\n\n\n<p>Upload you ssl\/tls key and full chain files to data directory and chnage permissions so your container has rights to access the two files. <\/p>\n\n\n\n<p>Start your Matrix server:<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-green-cyan-color has-black-background-color has-text-color has-background has-link-color wp-elements-61bb3184572bc3558e7b1ddb6be8cdee\"><code>docker-compose up -d<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Useful Commands<\/h2>\n\n\n\n<p>Create admin user:<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-green-cyan-color has-black-background-color has-text-color has-background has-link-color wp-elements-3fc51b68bbcf3f1ef86164228a5e2b44\"><code>register_new_matrix_user -c \/data\/homeserver.yaml<\/code><\/pre>\n\n\n\n<p>Restart Matrix container:<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-green-cyan-color has-black-background-color has-text-color has-background has-link-color wp-elements-bd9d3f91c9e8a0fc0222bfbad145e1a0\"><code>docker-compose restart matrix<\/code><\/pre>\n\n\n\n<p>Access your container CLI:<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-green-cyan-color has-black-background-color has-text-color has-background has-link-color wp-elements-d4e75594176be05d0f118b016f18925e\"><code>docker exec -it &lt;container_id> \/bin\/bash <\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Install Docker Add Docker&#8217;s official GPG key: Add Docker repository to apt sources: Install Docker and other required packages: Install Matrix with Docker Create\u00a0 docker-compose.yml Paste the lines below in the docker-compose.yml Generate Matrix container configuration Edit the homeserver.yml file in data directory and add the following configuration for TLS and registration: Upload you ssl\/tls [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[25,19,20,24,21,27,23,26,22],"class_list":["post-831","post","type-post","status-publish","format-standard","hentry","category-tutorials","tag-chat","tag-matrix","tag-matrix-chat-server","tag-matrix-on-docker","tag-matrix-server","tag-matrix-server-on-cloud","tag-matrix-synapse","tag-meggaging","tag-synapse"],"_links":{"self":[{"href":"https:\/\/techtutelage.net\/index.php?rest_route=\/wp\/v2\/posts\/831","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techtutelage.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techtutelage.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techtutelage.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/techtutelage.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=831"}],"version-history":[{"count":3,"href":"https:\/\/techtutelage.net\/index.php?rest_route=\/wp\/v2\/posts\/831\/revisions"}],"predecessor-version":[{"id":917,"href":"https:\/\/techtutelage.net\/index.php?rest_route=\/wp\/v2\/posts\/831\/revisions\/917"}],"wp:attachment":[{"href":"https:\/\/techtutelage.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=831"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techtutelage.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=831"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techtutelage.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=831"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}