Skip to content

Instantly share code, notes, and snippets.

@ddubson
Last active December 26, 2015 04:06
Show Gist options
  • Save ddubson/2217565de88de6d708d8 to your computer and use it in GitHub Desktop.
Save ddubson/2217565de88de6d708d8 to your computer and use it in GitHub Desktop.
Docker Deep Dive - Lab #2
1. Create a container from the base image for the latest version of Ubuntu available (if you do not have an Ubuntu base image installed locally, pull the latest one down for your local repository). The container should be started in interactive mode attached to the current terminal and running the bash shell. Once running, shut the container down by exiting.
# docker pull ubuntu
# docker run -t -i ubuntu:latest /bin/bash
# exit
2. Run the appropriate Docker command to get the name of the previously run container. Issue the appropriate command to restart the container that you obtained the name of. Do NOT create a new container, restart the one we just used.
## -l = latest
# docker ps -l
# docker restart desperate_babbage
3. Stop the container. Remove that container from the system completely using the appropriate command.
# docker stop desperate_babbage
# docker rm desperate_babbage
4. Create (not run) a container called "my_container", create it with parameters that will allow it to run interactively and attached to the local console running the bash shell. Verify that the container is not running.
# docker create --name my_container -t -i ubuntu:latest /bin/bash
# docker ps
5. Start the container and again, verify the container is running. Run the appropriate command to attach your session to the running container so you are logged into the shell.
# docker ps -l
# docker start my_container
# docker ps
# docker attach my_container
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment