{"id":13544207,"url":"https://github.com/strapi/strapi-docker","last_synced_at":"2025-10-23T03:31:03.081Z","repository":{"id":37733277,"uuid":"120316102","full_name":"strapi/strapi-docker","owner":"strapi","description":"Install and run your first Strapi project using Docker","archived":true,"fork":false,"pushed_at":"2024-06-28T05:40:31.000Z","size":220,"stargazers_count":1175,"open_issues_count":55,"forks_count":443,"subscribers_count":40,"default_branch":"master","last_synced_at":"2024-12-16T23:44:36.933Z","etag":null,"topics":["docker","docker-compose","strapi"],"latest_commit_sha":null,"homepage":"https://strapi.io","language":"JavaScript","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/strapi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-02-05T14:33:01.000Z","updated_at":"2024-12-11T23:56:00.000Z","dependencies_parsed_at":"2024-01-07T21:02:44.447Z","dependency_job_id":"c2c1b8de-81af-41ce-9983-fc71fa755008","html_url":"https://github.com/strapi/strapi-docker","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strapi%2Fstrapi-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strapi%2Fstrapi-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strapi%2Fstrapi-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strapi%2Fstrapi-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/strapi","download_url":"https://codeload.github.com/strapi/strapi-docker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237775565,"owners_count":19364272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["docker","docker-compose","strapi"],"created_at":"2024-08-01T11:00:43.690Z","updated_at":"2025-10-23T03:31:02.758Z","avatar_url":"https://github.com/strapi.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","\u003ca name='One-ClickDeployment'\u003e\u003c/a\u003eOne-Click \u0026 Deployment"],"sub_categories":[],"readme":"# [Strapi](https://github.com/strapi/strapi) containerized\n\n\u003e ⚠️  This image is only for Strapi v3. For now, we will not update it for v4.\n\u003e \n\u003e However, to build an image compatible with Strapi v4, we recommend you check out this tool created by the Strapi Community: https://github.com/strapi-community/strapi-tool-dockerize\n\u003c/br\u003e\n\n![Strapi](https://cldup.com/7umchwdUBh.png)\n\nAPI creation made simple, secure and fast.\nThe most advanced open-source Content Management Framework to build powerful API with no effort.\n\n---\n\n[![Travis](https://img.shields.io/travis/com/strapi/strapi-docker.svg?style=for-the-badge)](https://app.travis-ci.com/github/strapi/strapi-docker)\n[![Docker Pulls](https://img.shields.io/docker/pulls/strapi/strapi.svg?style=for-the-badge)](https://hub.docker.com/r/strapi/strapi)\n\n## Images\n\nStrapi comes with two images: `strapi/strapi` and `strapi/base`.\n\nUse [`strapi/strapi`](#how-to-use-strapistrapi) to create a new project or run a project on your host machine.\n\nUse [`strapi/base`](#how-to-use-strapibase) to build a Dockerfile and create an image for your app.\n\n## How to use `strapi/strapi`\n\nThis image allows you to create a new strapi project or run a project from your host machine. The default command that will run in your project is [`strapi develop`](https://strapi.io/documentation/v3.x/cli/CLI.html#strapi-develop-dev).\n\n### Creating a new project\n\nWhen running this image, strapi will check if there is a project in the `/srv/app` folder of the container. If there is nothing then it will run the [`strapi new`](https://strapi.io/documentation/developer-docs/latest/developer-resources/cli/CLI.html#strapi-new) command in the container /srv/app folder. You can create a new project by running this command.\n\n```bash\ndocker run -it -p 1337:1337 -v `pwd`/project-name:/srv/app strapi/strapi\n```\n\nThis command creates a project with an SQLite database. Then starts it on port `1337`.\n\nThe `-v` option creates a `project-name` folder on your computer that will be shared with the docker container.\nOnce the project is created it will be available in this folder on your computer.\n\n**Environment variables**\n\nWhen creating a new project with this image you can pass database configurations to the [`strapi new`](https://strapi.io/documentation/developer-docs/latest/developer-resources/cli/CLI.html#strapi-new) command.\n\n- `DATABASE_CLIENT` a database provider supported by Strapi: (sqlite, postgres, mysql ,mongo).\n- `DATABASE_HOST` database host.\n- `DATABASE_PORT` database port.\n- `DATABASE_NAME` database name.\n- `DATABASE_USERNAME` database username.\n- `DATABASE_PASSWORD` database password.\n- `DATABASE_SSL` boolean for SSL.\n- `EXTRA_ARGS` pass extra args to the [`strapi new`](https://strapi.io/documentation/developer-docs/latest/developer-resources/cli/CLI.html#strapi-new).\n\n**Example**\n\nYou can create a strapi project that will connect to a remote postgres database like so:\n\n```bash\ndocker run -it \\\n  -e DATABASE_CLIENT=postgres \\\n  -e DATABASE_NAME=strapi \\\n  -e DATABASE_HOST=0.0.0.0 \\\n  -e DATABASE_PORT=5432 \\\n  -e DATABASE_USERNAME=strapi \\\n  -e DATABASE_PASSWORD=strapi \\\n  -p 1337:1337 \\\n  -v `pwd`/project-name:/srv/app \\\n  strapi/strapi\n```\n\nYou can also create projects using docker-compose. See examples of using these variables with docker-compose in the [examples folder](./examples).\n\n### Running a project from your host machine\n\nYou can also use `strapi/strapi` to run a project you already have created (or cloned for a repo) on your computer.\n\nFirst make sure to delete the `node_modules` folder if you have already installed your dependencies on your host machine. Then run:\n\n```bash\ncd my-project\ndocker run -it -p 1337:1337 -v `pwd`:/srv/app strapi/strapi\n```\n\nThis will start by installing the dependencies and then run `strapi develop` in the project.\n\n**Environment variables**\n\nIf you are using environment variables in your code you can pass them with the -e option (e.g `docker run -e ENV_VAR=sth ...`).\n\nYou can for example set your database configuration with environment variables.\nBecause the default container command is [`strapi develop`](https://strapi.io/documentation/v3.x/cli/CLI.html#strapi-develop-dev) you will need to update your `development` database configuration following the `production` example in the [documentation](https://strapi.io/documentation/v3.x/concepts/configurations.html#dynamic-configurations). Then you can run:\n\n```bash\ndocker run -it \\\n  -e DATABASE_NAME=strapi \\\n  -e DATABASE_HOST=0.0.0.0 \\\n  -e DATABASE_PORT=1234 \\\n  -e DATABASE_USERNAME=strapi \\\n  -e DATABASE_PASSWORD=strapi \\\n  -p 1337:1337 \\\n  -v `pwd`/project-name:/srv/app \\\n  strapi/strapi\n```\n\n\n### Upgrading Strapi in Docker container\n\n- **Important!** Upgrading `strapi/strapi` Docker image tag **does not** upgrade Strapi version.\n  - Strapi NodeJS application builds itself during first startup only, if detects empty folder and is normally stored in mounted volume. See [docker-entrypoint.sh](https://github.com/strapi/strapi-docker/blob/master/strapi/docker-entrypoint.sh).\n- To upgrade, first follow the guides ([general](https://strapi.io/documentation/developer-docs/latest/guides/update-version.html) and [version-specific](https://strapi.io/documentation/developer-docs/latest/migration-guide/)) to rebuild actual Strapi NodeJS application. Secondly, update docker tag to match the version to avoid confusion.\n\n## How to use `strapi/base`\n\nWhen deploying a strapi application to production you can use docker to package your whole app in an image. You can create a Dockerfile in your strapi project like the one in [`./examples/custom`](./examples/custom)\n\n## Building the images in this repository\n\nYou can build the images with the build command. To see the options run:\n\n```\nyarn install\n./bin/build.js --help\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrapi%2Fstrapi-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstrapi%2Fstrapi-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrapi%2Fstrapi-docker/lists"}