question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Advice on setting up a hybrid Java and Python devcontainer

See original GitHub issue

I want to setup a devcontainers environment for a Django Python project. I was curious about using the SonarLint extension.

SonarLint has a dependency on the JRE11+ being installed.

What is the best approach to take in setting up a devcontainer for this type of project?

What am I trying?

At the minute I am unsuccessfully trying to look at the following folders to try and set my own Dockerfile and devcontainer.json up.

https://github.com/devcontainers/images/tree/main/src/java https://github.com/devcontainers/images/tree/main/src/python

This uses the mcr.microsoft.com/devcontainers/base:bullseye. My thoughts were to copy the Dockerfile instructions as per the Java Dockerfile then trying to install Python 3.11 separately.

RUN arch="$(dpkg --print-architecture)" \
  ...

 RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
     && apt-get -y install --no-install-recommends python3.11 python3-pip

Which yields the following problems in the log file:

#0 5.837 E: Couldn't find any package by glob 'python3.11'
#0 5.837 E: Couldn't find any package by regex 'python3.11'

I’ve attached by feeble attempt at this for the devcontainer.json and docker file.

devcontainer.json.txt Dockerfile.txt

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
andez2000commented, Nov 21, 2022

Wow… So it does work 😃 Thanks a lot

{
	"image": "mcr.microsoft.com/devcontainers/python:3.11",
	"features": {
		"ghcr.io/devcontainers/features/java:1": {
			"version": "11"
		}
	}
}
1reaction
samruddhikhandalecommented, Nov 18, 2022

Hi @andez2000 👋

Could you try with this Dev Container config 👇 ?

// .devcontainer/devcontainer.json
{
	"image": "mcr.microsoft.com/devcontainers/python:3.11",
	"features": {
		"ghcr.io/devcontainers/features/java:1": {
			"version": "11"
		}
	}
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Reproducible Development with Devcontainers - InfoQ
To do this, I made a set of configuration files for Docker, separate from docker configuration files used in creating deployment containers.
Read more >
How to create a Devcontainer for your Python project
To recap, we are trying to create a dev environment that installs: 1) Java, 2) Python and 3) pyspark. And we want to...
Read more >
Create a Dev Container - Visual Studio Code
In this document, we'll go through the steps for creating a development (dev) container in VS Code: Create a devcontainer.json , which describes...
Read more >
Development Containers & GitHub Codespaces kill the "works ...
Now a new VS Code window will open up and tell you that it's Starting Dev Container where you can view the logs...
Read more >
Build your first Python application in a Linux container
This quick tutorial guides you through building a Python web service on Red ... Now you can start using Python via the python3.9...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found