- This will create a container named ubuntu_bash and start a Bash session:
docker run --name ubuntu_bash --rm -i -t ubuntu bash
- This will create a new file /tmp/execWorks inside the running container ubuntu_bash, in the background:
docker exec -d ubuntu_bash touch /tmp/execWorks
- This will create a new Bash session in the container ubuntu_bash:
docker exec -it ubuntu_bash bash
- This will create a new Bash session in the container ubuntu_bash with environment variable $VAR set to “1”. Note that this environment variable will only be valid on the current Bash session:
docker exec -it -e VAR=1 ubuntu_bash bash
I did literally followed this steps #1 worked well created a container a put me into the InterActive Shell, but when issue the step #2 into/inside the shell from that Ubuntu container a receive next error:
bash: docker: command not found
In my understanding make sense this error because inside that recently created container doesn't exist docker so it will not recognize any docker-command I issue in it.
Which are my options to make this happen as they stated in this tutorial, below the official docker.com URL: https://docs.docker.com/engine/reference/commandline/exec/