Can I pass environment variables to a Docker container using Cockpit?

606 views Asked by At

I don't see such an option in the UI:

Cockpit's Run Image dialog box.

2

There are 2 answers

2
Ken Cochrane On

You can probably pass it in the command field

Try -e MYENV=24 and see if that shows up in the container

0
User not found On

According to a comment by a Cockpit developer, the UI doesn't currenly expose the ability to specify environment variables when starting a container.

The recommended approach is to simply run docker run from the command line and pass the environment variables in the traditional way, thus bypassing Cockpit's Run Image dialog:

docker run -e "MYENV=24" myimage

Once created, the resulting container can still be monitored and managed from Cockpit.