Run toolbox with environment variables

Hello everyone,

I want to use the toolbox to use Node.js, but I have to use some variables in the build command.
Since I would like to use this in ansible I thought it can be used with toolbox run -c, but I don’t understand how to pass the variables.

PHANPY_CLIENT_NAME="Phanpy Dev" \
	PHANPY_WEBSITE="https://dev.phanpy.social" \
	PHANPY_DEFAULT_INSTANCE=hachyderm.io \
	PHANPY_DEFAULT_INSTANCE_REGISTRATION_URL=https://hachyderm.io/auth/sign_up \
	PHANPY_PRIVACY_POLICY_URL=https://hachyderm.io/privacy-policy \
	npm run build

But if i try it i get this error:

bash: line 1: exec: PHANPY_CLIENT_NAME=Phanpy Dev not found
Error: command PHANPY_CLIENT_NAME=Phanpy Dev not found in container nodejs

Hello @tealk ,

you may want to look at node.js dev conttainers specifically … GitHub - nodejs/devcontainer: developer environment for Node.js core

Ok apparently it works if you tag the variables with env

toolbox run -c nodejs env PHANPY_CLIENT_NAME="Phanpy Dev" env PHANPY_WEBSITE="https://dev.phanpy.social" env PHANPY_DEFAULT_INSTANCE=hachyderm.io env PHANPY_DEFAULT_INSTANCE_REGISTRATION_URL=https://hachyderm.io/auth/sign_up env PHANPY_PRIVACY_POLICY_URL=https://hachyderm.io/privacy-policy npm run build
1 Like

Cool! Also found this, may be of interest … NodeJS virtual environment in Fedora Toolbox - DEV Community

I don’t understand the linked article right now.


I’m just thinking whether it’s possible to store variables in the container?

I didn’t read it, just skimmed, but I thought it was related to your desire to run node in a toolbox container.