{"id":13469829,"url":"https://github.com/ryansheehan/terraria","last_synced_at":"2026-02-05T02:01:01.132Z","repository":{"id":2154725,"uuid":"38842845","full_name":"ryansheehan/terraria","owner":"ryansheehan","description":"Dockerfile for terraria","archived":false,"fork":false,"pushed_at":"2026-01-31T02:42:03.000Z","size":199,"stargazers_count":358,"open_issues_count":29,"forks_count":114,"subscribers_count":9,"default_branch":"master","last_synced_at":"2026-01-31T17:30:16.337Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryansheehan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2015-07-09T20:12:50.000Z","updated_at":"2026-01-31T10:17:46.000Z","dependencies_parsed_at":"2025-02-02T16:36:08.243Z","dependency_job_id":null,"html_url":"https://github.com/ryansheehan/terraria","commit_stats":{"total_commits":183,"total_committers":58,"mean_commits":"3.1551724137931036","dds":0.7049180327868853,"last_synced_commit":"b68a2d408d55bfafb9a7e316ea66e0f7c81049c8"},"previous_names":[],"tags_count":89,"template":false,"template_full_name":null,"purl":"pkg:github/ryansheehan/terraria","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryansheehan%2Fterraria","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryansheehan%2Fterraria/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryansheehan%2Fterraria/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryansheehan%2Fterraria/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryansheehan","download_url":"https://codeload.github.com/ryansheehan/terraria/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryansheehan%2Fterraria/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29107301,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T00:52:08.035Z","status":"online","status_checked_at":"2026-02-05T02:00:07.839Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T16:00:17.265Z","updated_at":"2026-02-05T02:01:01.016Z","avatar_url":"https://github.com/ryansheehan.png","language":"Dockerfile","funding_links":[],"categories":["Apps","Dockerfile"],"sub_categories":["Gaming"],"readme":"# Terraria\n\nThis project is a Dockerfile to containerize [TShock][TShock] and [Terraria Server](https://terraria.org/) TerrariaServer.exe to run on linux.  [Docker][Docker] will remove the need for someone to worry about how to setup a server in linux with all the right dependencies to run.  The installation and usage instructions are written with complete beginners in mind.\n\n## Quick start guide\n\nFirst you need a linux machine with [Docker][Docker] installed. Everything from here on out assumes the docker service is running _(you may need to start the service after install)_.\n\n### Create directory to save your world to\n\nNext create a directory for your world file, configuration, and logs\n\n```bash\nmkdir -p $HOME/terraria/world\n```\n\n### Creating a fresh world\n\nFor the first run you will need to generate a new world with a size where: _1=Small, 2=Medium, 3=Large_\n\n```bash\nsudo docker run -it -p 7777:7777 --rm -v $HOME/terraria/world:/root/.local/share/Terraria/Worlds ryshe/terraria:latest -world /root/.local/share/Terraria/Worlds/\u003cworld_name_here\u003e.wld -autocreate \u003cworld_size_number_here\u003e\n```\n\n**Note:** If you close the the terminal, the server will stop running.  You will need to restart with a preexisting world. It may\nbe worth while to close after creation anyway to update the initial `config.json` settings.\n\nTo create a world with a few more initial options, you can do so in an interactive mode.\n\n```bash\nsudo docker run -it -p 7777:7777 --rm -v $HOME/terraria/world:/root/.local/share/Terraria/Worlds ryshe/terraria:latest\n```\n\n### To start with a preexisting world\n\n```bash\nsudo docker run -d --rm -p 7777:7777 -v $HOME/terraria/world:/root/.local/share/Terraria/Worlds --name=\"terraria\" -e WORLD_FILENAME=\u003c.wld world_filename_here\u003e ryshe/terraria:latest\n```\n\n**Note:** This command is designed to run in the background, and it is safe to close the terminal window.\n\nAny `config.json` in the directory will automatically be loaded.  The `\u003cworld_file_name\u003e.wld` should be the name of your wld file in your $HOME/terraria/world directory.\n\n## Updating your container\n\nUpdating is easy!\n\n1. Grab the latest terraria container\n\n    ```bash\n    docker pull ryshe/terraria:latest\n    ```\n\n2. First we need to find our running container to stop, so we can later restart with the latest\n\n    ```bash\n    docker container ls | grep ryshe/terraria\n    ```\n\n    The first few numbers and letters, on a line, are the container hash.  Remember the first 3 or so letters or numbers\n\n    Example:\n\n    ```bash\n    f25261ac55a4        ryshe/terraria:latest   \"/bin/sh bootstrap.s…\"   3 minutes ago       Up 3 minutes        0.0.0.0:7777-\u003e7777/tcp, 7878/tcp   reverent_solomon\n    ```\n\n    `f25` would be the first few letters/numbers of the container hash\n\n    **NOTE:** If you see multiple lines, find the one that still has an `up` status.\n\n3. Stop and remove the container\n\n    ```bash\n    docker container rm -f xxx # xxx is the letters/numbers from the last step\n    ```\n\n4. Start your container again with your world _(see the [Quick start](#Quick-start-guide))_\n\n## [Virtual] Machine Setup\n\nProvision a linux machine that can support docker and containerization.  For more information visit [docker][Docker].  For a small or medium world with no more than 8 users a linux machine with 1-1.5GB of ram should suffice.  **If you are running a vm in the cloud, make sure to expose tcp port 7777 and udp port 7777.**\n\nBefore starting the build process make sure the [latest tshock version][TShock] is specified in the [Dockerfile](https://github.com/ryansheehan/terraria/blob/master/Dockerfile) under\n\n```Dockerfile\nADD https://github.com/Pryaxis/TShock/releases/download/v5.2.3/TShock-5.2.3-for-Terraria-1.4.4.9-linux-amd64-Release.zip\n```\n\n## Building from source\n\nAssuming [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [docker][Docker] are installed..\n\n1. Clone this repository\n\n    ```bash\n    git clone https://github.com/ryansheehan/terraria.git\n    ```\n\n2. Open a terminal window into the directory downloaded by the git\n3. Build the container\n\n    ```bash\n    docker build -t \u003cname_here\u003e .\n    ```\n\n## Running a container image\n\nWhether you build your own container, or use [my container](https://hub.docker.com/r/ryshe/terraria) published to docker hub,\nwe are ready to run our terraria server!\n\n**Note:** For a full set of docker run options go [here](https://docs.docker.com/engine/reference/run/)\n\n### First run\n\nThe first run of the server will give you the opportunity to create a world, and it will generate\nthe server's config file.  You may wish to add the config file for many reasons, but one of which is to\nadd a password to your server.\n\n```bash\ndocker run -it --rm -p 7777:7777 -v $HOME/terraria/world:/root/.local/share/Terraria/Worlds ryshe/terraria:latest\n```\n\nLet's break down this command:\n\n| Command Part | Description |\n| ------------ | ----------- |\n| `docker run` | tells linux to run a docker image |\n| `-it` | run interactively and output the text to terminal |\n| `--rm` | remove docker container when the container stops or fails |\n| `-p 7777:7777` | exposes terraria port \u0026lt;host machine side\u003e:\u0026lt;container side\u003e |\n| `-v $HOME/terraria/world:/root/.local/share/Terraria/Worlds` | maps a folder on the host machine into the container for saving the .wld file.  This does not have to be `$HOME/terraria/world`.  Anything left of the `:` is host machine directory |\n| `ryshe/terraria` | the name of the image. This could be your image if you build from source |\n| `:latest` | the tag, which defaults to `latest` if not specified.  `latest` is the most recently published container |\n\n* The config file can be found in the directory specified by the `-v` volume.\n* If the terminal window is shut down, that will exit the process.  Make sure to do so after the world is created!\n\n### Running with an existing generated world\n\nAfter a world has been generated, you may want to load directly into it.\n\n```bash\ndocker run -d --rm -p 7777:7777 -v $HOME/terraria/world:/root/.local/share/Terraria/Worlds ryshe/terraria:latest -world /root/.local/share/Terraria/Worlds/\u003cworld_filename_here\u003e.wld\n```\n\nLet's break down the command:\n\n| Command Part | Description |\n| ------------ | ----------- |\n| `-d` | run this in the background.  It is okay to close the terminal window, the container will continue to run |\n| `-world /root/.local/share/Terraria/Worlds/\u003cworld_filename_here\u003e.wld` | specifies the world file name you wish to immediately load into |\n\n* for the other parts check out the [First run](#First-run) section\n* check out additional server startup flags [here](https://tshock.readme.io/docs/command-line-parameters).  They go on\nafter the `ryshe/terraria:latest` portion of the line\n\n### Docker Compose example with previously generated world\n\nHere is a sample docker compose file that can be used to start the server. The command option lets you pass the flags needed to load the world and the config file.\nThe stdin_open and tty options are a workaround to running the container in detached mode without crashing the server. \n\n\n(Note for Podman users: Ensure to add the :Z flag to the volume to give the container access to the volume.)\n\n```yaml\n\nversion: \"3\"\nservices:\n  terraria:\n    container_name: terraria\n    image: ryshe/terraria:latest\n    stdin_open: true # docker run -i\n    tty: true # docker run -t\n    environment:\n      - WORLD_FILENAME=world.wld\n      - CONFIGPATH=config.json\n    ports:\n      - 7777:7777\n    volumes:\n      - \u003cworld-dir-location\u003e:/root/.local/share/Terraria/Worlds\n    restart: unless-stopped\n\n```\n## Plugin support\n\nA volume exists to support plugins.  Create a folder, not inside your `/world` folder, for your plugins\n\n```bash\nmkdir ServerPlugins\n```\n\nMount the plugins directory with an additional -v switch on your `docker run ...` command\n\n```bash\n-v \u003cpath_to_your_ServerPlugins_folder\u003e:/plugins\n```\n\n## Environment variables\n\nAbility to overwrite file locations and file names\n\n**Vanilla**\n\n```bash\nENV LOGPATH=/terraria-server/logs\nENV WORLDPATH=/root/.local/share/Terraria/Worlds\nENV WORLD_FILENAME=\"\"\nENV CONFIGPATH=/config\nENV CONFIG_FILENAME=\"serverconfig.txt\"\n```\n\n## Logs\n\nA separate directory can be volumed in for storing logs outside of the image\n\n```bash\n-v \u003cpath_to_store_logs\u003e:/tshock/logs\n```\n\n## *Notes*\n\n* `sudo` may be required to run docker commands.\n\n* Please post to the [TShock](https://github.com/Pryaxis/TShock/discussions) team with questions on how to run a server.\n\n* Any [additional command-line instructions](https://tshock.readme.io/docs/command-line-parameters) can be added to the end of either method for launching a server.  Docker maps the $HOME/terraria/world linux-host folder to the /tshock/world container-folder.\n\n* Expecting your server to run for a while?  Add `--log-opt max-size=200k` to limit your log file size.  Otherwise one day you will wake up to see all your hdd space chewed up for a terraria docker setup!\n\n## *Contributing*\n\nEmail me rsheehan at gmail dot com if any of these instructions do not seem to work.\n\n1. Fork it!\n2. Create your feature branch: `git checkout -b my-new-feature`\n3. Commit your changes: `git commit -am 'Add some feature'`\n4. Push to the branch: `git push origin my-new-feature`\n5. Submit a pull request :D\n\n## *TODO*\n\n* Fork TShock and create a Dockerfile to build the project\n\n[TShock]: https://github.com/Pryaxis/TShock/releases\n[Docker]: https://docs.docker.com/get-docker/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryansheehan%2Fterraria","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryansheehan%2Fterraria","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryansheehan%2Fterraria/lists"}