Code Monkey home page Code Monkey logo

godevcntnr's Introduction

Testing devcontainers (for golang) using podman on Windows

  1. Make sure you have Podman running on your Windows box. A quick check is to do
podman version

which should report entries for "Podman client" and "Podman Engine". If this does not work, but you had Podman working, you may have forgotten to restart the WSL instance that actually runs the Podman engine. You can do this by running

podman machine start
  1. Create the devcontainer. If you don't have the CLI installed, you can do:
npm install @devcontainer/cli -g

Then, you can create the devcontainer by running

devcontainer up --docker-path podman --workspace-path .

Note that the devcontainer CLI requires node to run. If you don't have it installed, you can do it either from Visual Studio or from winget:

winget install -e --id OpenJS.NodeJS.LTS

(if you've installed devcontainer not as a global tool, but under the root of this repository, you may need to prepend npx to the command above)

  1. Log on to the container and build the project:
npx devcontainer exec --docker-path podman --workspace-folder . bash

which will open an interactive shell inside the container. You can then build the project by running

pushd /workspaces/first/src/main
go build

Alternatively, you can issue the build command directly from the host by running

npx devcontainer exec --docker-path podman --workspace-folder . go build -o <NAMEFOREXECUTABLE> /workspaces/first/src/main/main.go

If you choose to run the container interactively, you can debug by issuing

dlv debug

Issues

  • VSCode somehow fails to build the devcontainer. For the moment all testing has been done in the cli.

godevcntnr's People

Contributors

rgesteve avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.