Quickstart (original) (raw)
Follow this guide to get started with creating a basic Docker extension. The Quickstart guide automatically generates boilerplate files for you.
Note
NodeJS and Go are only required when you follow the quickstart guide to create an extension. It uses the
docker extension init
command to automatically generate boilerplate files. This command uses a template based on a ReactJS and Go application.
In Docker Desktop settings, ensure you can install the extension you're developing. You may need to navigate to the Extensions tab in Docker Desktop settings and deselect Allow only extensions distributed through the Docker Marketplace.
To set up your directory, use the init
subcommand and provide a name for your extension.
The command asks a series of questions about your extension, such as its name, a description, and the name of your Hub repository. This helps the CLI generate a set of boilerplate files for you to get started. It stores the boilerplate files in the my-extension
directory.
The automatically generated extension contains:
- A Go backend service in the
backend
folder that listens on a socket. It has one endpoint/hello
that returns a JSON payload. - A React frontend in the
frontend
folder that can call the backend and output the backend’s response.
For more information and guidelines on building the UI, see theDesign and UI styling section.
To build the extension, move into the newly created directory and run:
docker build
builds the extension and generates an image named the same as the chosen hub repository. For example, if you typed john/my-extension
as the answer to the following question:
The docker build
generates an image with name john/my-extension
.
To install the extension in Docker Desktop, run:
To preview the extension in Docker Desktop, once the installation is complete and you should see a Quickstart item underneath the Extensions menu. Selecting this item opens the extension's frontend.
Tip
During UI development, it’s helpful to use hot reloading to test your changes without rebuilding your entire extension. SeePreview whilst developing the UI for more information.
You may also want to inspect the containers that belong to the extension. By default, extension containers are hidden from the Docker Dashboard. You can change this in Settings, seehow to show extension containers for more information.
If you want to make your extension available to all Docker Desktop users, you can submit it for publication in the Marketplace. For more information, seePublish.
To remove the extension, run:
- Build a moreadvanced frontend for your extension.
- Learn how totest and debug your extension.
- Learn how tosetup CI for your extension.
- Learn more about extensionsarchitecture.
- Learn more aboutdesigning the UI.