OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "export": executable file not found in $PATH: unknown
Even if this would work, then it would only export it in the very -it interactive TTY session that you started with the above command. It would not be available in the running container, so would not be available to the one you already started using docker run -it mcr.microsoft.com/azure-cli.
So, how are you planning to use it?
If you want the environment variable to be available in your Azure CLI, then on a Mac the following run works:
Correct I do not want to do it in interactive mode i want to run set of commands in my docker container to publish artifacts to azure devops universal feed. Where the following steps would involve.
Run Azure CLI image
Enable Devops extension
Set Azure PAT
And publish artifacts generated in Build stage to Azure DevOps
I’m pretty new to docker can you please guide me how to do ?
% docker run -e AZURE_DEVOPS_EXT_PAT=3wl...xzq mcr.microsoft.com/azure-cli bash -c 'export MY_ENV=some-val; echo $MY_ENV; echo $AZURE_DEVOPS_EXT_PAT; ls -a'
some-val
3wl...xzq
.
..
.dockerenv
bin
dev
etc
home
lib
lib64
media
mnt
opt
proc
root
run
sbin
srv
sys
tmp
usr
var