Store `docker run` command output in BASH variable
问题 I'm having an issue storing the output of docker run -it -d -p 43211:3000 --name appname -h hostname -v $PWD/local_dir:/root/remote_dir repo/imagename in a BASH varibale. I tried `backticks`, I also tried running it like the official docs say BASH_VAR=$(docker run ...) , I even tried storing the output in a file with docker run --...>$FILE_DESCRIPTOR , but no luck storing the error situation, the situation when the name is already used by another container, like so: $ FATA[0000] Error