I have a problem saving output docker run -it -d -p 43211:3000 --name appname -h hostname -v $PWD/local_dir:/root/remote_dir repo/imagename in varibale BASH. I tried "backticks", I also tried to run it, as official docs BASH_VAR=$(docker run ...) , I even tried to save the output to a file using docker run --...>$FILE_DESCRIPTOR , but failed save the situation with the error, the situation when the name is already in use by another container, for example:
$ FATA[0000] Error response from daemon: Conflict. The name "appname" is already in use by container 7c84d8d703c8. You have to delete (or rename) that container to be able to reuse that name.
I want to say that it works for success, so I can store the full container identifier in BASH_VAR when the application starts successfully, but, unfortunately, this solves only half of the problem that I encountered.
Any help would be greatly appreciated.
Thanks!
source share