Skip to content

Compare the Dockerfile of 2 images and find their differences.

Notifications You must be signed in to change notification settings

felipecruz91/dockerfile-diff-extension

Repository files navigation

Dockerfile Diff

screenshot

Install the extension from this link https://open.docker.com/extensions/marketplace?extensionId=felipecruz/dockerfile-diff-extension&tag=0.0.6 or from the CLI:

docker extension install felipecruz/dockerfile-diff-extension:0.0.6

This repository defines an example of a Docker extension. The files in this repository have been automatically generated as a result of running docker extension init.

This extension is composed of:

  • A frontend app in React that makes a request to the /hello endpoint and displays the payload in Docker Desktop.
  • A backend container that runs an API in Go. It exposes the /hello endpoint which returns a JSON payload.

You can build your Docker Extension using your fav tech stack:

  • Frontend: React, Angular, Vue, Svelte, etc. Basically, any frontend framework you can bundle in an index.html file with CSS, and JS assets.
  • Backend (optional): anything that can run in a container.
Looking for more templates?
  1. React + NodeJS.
  2. React + .NET 6 WebAPI.

Request one or submit yours here.

Local development

You can use docker to build, install and push your extension. Also, we provide an opinionated Makefile that could be convenient for you. There isn't a strong preference of using one over the other, so just use the one you're most comfortable with.

To build the extension, use make build-extension or:

  docker buildx build -t felipecruz/dockerfile-diff-extension:latest . --load

To install the extension, use make install-extension or:

  docker extension install felipecruz/dockerfile-diff-extension:latest

If you want to automate this command, use the -f or --force flag to accept the warning message.

To preview the extension in Docker Desktop, open Docker Dashboard once the installation is complete. The left-hand menu displays a new tab with the name of your extension. You can also use docker extension ls to see that the extension has been installed successfully.

Frontend development

During the development of the frontend part, it's helpful to use hot reloading to test your changes without rebuilding your entire extension. To do this, you can configure Docker Desktop to load your UI from a development server. Assuming your app runs on the default port, start your UI app and then run:

  cd ui
  npm install
  npm run dev

This starts a development server that listens on port 3000.

You can now tell Docker Desktop to use this as the frontend source. In another terminal run:

  docker extension dev ui-source felipecruz/dockerfile-diff-extension:latest http://localhost:3000

In order to open the Chrome Dev Tools for your extension when you click on the extension tab, run:

  docker extension dev debug felipecruz/dockerfile-diff-extension:latest

Each subsequent click on the extension tab will also open Chrome Dev Tools. To stop this behaviour, run:

  docker extension dev reset felipecruz/dockerfile-diff-extension:latest

Backend development (optional)

This example defines an API in Go that is deployed as a backend container when the extension is installed. This backend could be implemented in any language, as it runs inside a container. The extension frameworks provides connectivity from the extension UI to a socket that the backend has to connect to on the server side.

Note that an extension doesn't necessarily need a backend container, but in this example we include one for teaching purposes.

Whenever you make changes in the backend source code, you will need to compile them and re-deploy a new version of your backend container. Use the docker extension update command to remove and re-install the extension automatically:

docker extension update felipecruz/dockerfile-diff-extension:latest

If you want to automate this command, use the -f or --force flag to accept the warning message.

Extension containers are hidden from the Docker Dashboard by default. You can change this in Settings > Extensions > Show Docker Extensions system containers.

Clean up

To remove the extension:

docker extension rm felipecruz/dockerfile-diff-extension:latest

What's next?

About

Compare the Dockerfile of 2 images and find their differences.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published