Welcome to my Docker Essentials series, which teaches you the basics you’ll need to know in order to get started with Docker. In this video, we’ll look at ways we can make containers persist.
Launch an Ubuntu container, and attach to its shell
We’ve already run this container in the previous video, so the command is used again as a reminder. However, the command is simplified from the previous video.
docker run -it ubuntu
Launch an Ubuntu container in a ‘detached’ state
The following command will launch an Ubuntu container similar to before, but will launch it in the background:
docker run -it -d ubuntu
Launch an Ubuntu container, but have it relaunch if stopped
docker run -d -it –restart unless-stopped ubuntu