DevDock is a VS Code extension for managing Docker-based development environments.
- Create and manage Docker containers for development.
- Simplified workflows for building, running, and debugging code in isolated environments.
- Download the extension from the VS Code Marketplace.
- Install using the Extensions view in Visual Studio Code.
-
Create an Empty Directory and Open It in VSCode
- Start by creating a new empty directory.
- Open the directory in VSCode.
-
Create a File with Your Desired Programming Language Extension
- Example: main.py for Python.
-
Select the File in the Sidebar and Run devdock.run
- Use the shortcut: Cmd (Ctrl) + Shift + Alt + R.
-
A {language}.Dockerfile is Automatically Generated
-
For Python, this would be python.Dockerfile:
FROM python:3.12-alpine COPY . /app COPY requirements.txt /app WORKDIR /app RUN pip install --no-cache-dir -r requirements.txt EXPOSE 8080 80 EXPOSE 443 VOLUME /data VOLUME /data /tmp # The second "/data" will be ignored as it's duplicated VOLUME [ "/data" ] # This "/data" will also be ignored due to duplication VOLUME [ "/data", "/tmp2" ] # Only "/tmp2" is added as "/data" is redundant CMD ["python3", "main.py"]
-
-
Modify the Generated Files as Needed for Your Development Environment
-
When using the EXPOSE keyword, ports will be automatically mapped to random ports during execution:
-p 8080:{random_port} -p 80:{random_port} -p 443:{random_port}
-
When using the VOLUME keyword, a python.Dockerfile.mount.json file is generated to define host-directory mappings.
-
Example python.Dockerfile.mount.json:
{ "volumes": { "/host/path": "/container/path", "/data": "/app/data", "/tmp": "/app/tmp", "/tmp2": "/app/tmp2" } }
-
-
Check Container Logs with devdock.logs
- Use this command to view the output inside the running container.
-
Open the Configuration File with devdock.openConfig
- This command opens the configuration file, where you can:
- Edit the default Dockerfile template.
- Add support for additional programming languages.
- Even if the extension is uninstalled, this configuration file remains.
- When updating the extension, existing configurations take precedence and are merged with the latest version.
- If you want to remove it, you must manually delete the configuration file from its directory.
- This command opens the configuration file, where you can:
Shortcut | Commnad | Function |
---|---|---|
cmd(ctrl) + shift + alt + r | devdock.run | build and run |
cmd(ctrl) + shift + alt + c | devdock.clean | clean all images and containers |
cmd(ctrl) + shift + alt + l | devdock.logs | container logs |
cmd(ctrl) + shift + alt + o | devdock.openConfig | Open your config file. |
- Initial release.
- Bug fix and update.