devcontainers-contrib/features

Where are default MYSQL credentials?

Opened this issue · 2 comments

Requested Feature

Hi,

My devcontainer.json is:

{
  "image": "mcr.microsoft.com/devcontainers/base:ubuntu",
  "features": {
    "ghcr.io/shyim/devcontainers-features/php:0": {
	"version": 8.1
    },
    "ghcr.io/devcontainers-contrib/features/mysql-homebrew:1": {},
  },
}

The problem here with MYSQL, is that I don't know what are default credentials for MYSQL, to be able to connect to the database.

Thanks in advance

I think devcontainer features in general only address the installation of additional packages / tools to the base image. So, like other devcontainer features, you can only select different version or different way of install a package. The setting of default credential for MySQL seems like out of scope of devcontainer features. However, to achieve this, you can try to use postCreateCommand of devcontainer.

{
  "image": "mcr.microsoft.com/devcontainers/base:ubuntu",
  "features": {
    "ghcr.io/shyim/devcontainers-features/php:0": {
	"version": 8.1
    },
    "ghcr.io/devcontainers-contrib/features/mysql-homebrew:1": {},
  },
 "postCreateCommand": "mysqladmin -u root password 123456"
}

where the user name is root and password is 123456. This command run only once, when the devcontainer is created

This project is not associated with the devcontainer project and appears to have been abandoned #628 . The official project has removed all devcontainer-contrib features from their listing. devcontainers/devcontainers.github.io#451. There is a fork that is being worked on to update and maintain the features https://github.com/devcontainers-extra/features