The next command we can run is something like this. It will pull down a docker image and run a “hello-world” command to produce output and then terminate.
docker run hello-world
apt-get install docker-compose
docker-compose run mine /bin/bash
- https://docs.docker.com/get-started/
OK now we are going to create a persistent container and connect to it by running bash from inside the container
docker exec -it mine /bin/bash
docker run -t -i --volumes-from mine ubuntu /bin/bash
root@ed0491896b3b:/#
From this we can tell we are running BASH inside a host mounted in the container we have created. Next we are going to update APT DEB cache inside our container. Remember this has never been done before so simply using apt-get install vim will not cut it.
apt-get update
apt-get install vim -y
Then you can use VI to create a file like “test.txt”. Now when you type exit… you will be leaving that environment.