Quickstart using Docker
In this document, you will learn how to make a container of Medusa's app on Docker. Docker is an open source platform for building, deploying, and managing containerized applications.
Medusa supports Node versions 14 and 16. You can check which version of Node you have by running the following command:
You can install Node from the official website.
It is assumed that you have Docker installed on your system. You can install it from Docker's website.
Create Medusa Server with Docker
1. Clone Medusa's starter project from GitHub
git clone https://github.com/medusajs/medusa-starter-default.git my-medusa-starter
2. Change to the newly created project directory
3. Rename the environment variables(.env) file
mv .env.template .env
4. Start your server
Make sure the Docker Desktop app is running. Then, run the following command:
docker-compose up --build
If you get the error Copy to Clipboard, change the ports used for PostgreSQL in Copy to Clipboard to something like this:
Running the above command does the following:
- Build images for your Medusa project, a PostgreSQL database, and a Redis server
- Run migrations for your newly created database
Test Your Server
Once done, your server will be accessible at Copy to Clipboard.
You can test out your server using tools like Postman or by sending a cURL request:
curl -X GET localhost:9000/store/products | python -m json.tool
This command uses Python to format the result of the request better in your command line. If you don't want to use Python you can simply send a request without the formatting:
File Service Plugin
To upload product images to your Medusa server, you must install and configure one of the following file service plugins:
It's important to configure your Medusa server properly and learn how environment variables are loaded.
You can learn more about configuring your server and loading environment variables in the Configure your Server documentation.
- Install the Next.js or Gatsby storefronts to set up your ecommerce storefront quickly.
- Install the Medusa Admin to supercharge your ecommerce experience with easy access to configurations and features.
- Check out the API reference to learn more about available endpoints available on your Medusa server.
- Install plugins for features like Payment, CMS, and Notifications, among other features.