Docker has taken the container world by storm. If you understood LXC from the previous post, Docker will feel like a polished toolkit built on similar ideas. This post gives you a quick start so you can begin running containers in minutes.
First, install Docker on your system. On Linux you can install it via your distribution’s package manager. On Windows and macOS you can download Docker Desktop from the official Docker website. Once installed, verify it works:
Run your first container:
To see running containers:
To exit:
Happy Dockering.
First, install Docker on your system. On Linux you can install it via your distribution’s package manager. On Windows and macOS you can download Docker Desktop from the official Docker website. Once installed, verify it works:
docker --versionIf you see version information, you are ready.
Run your first container:
docker run hello-worldDocker will pull the image if it does not exist locally and then execute it. Congratulations. You just ran your first container.
To see running containers:
docker psTo see all containers including stopped ones:
docker ps -aTo run an interactive Ubuntu container:
docker run -it ubuntu /bin/bashYou are now inside the container shell.
To exit:
exitTo stop a running container:
docker stopTo remove a container:
docker rmTo remove an image:
docker rmiDocker makes container management simple and repeatable. Once you start using it for development environments or microservices, you may wonder how you ever worked without it.
Happy Dockering.
Disclaimer: If you follow the information here, there is no warranty, I am not liable if it deletes your data, gets you hacked, burns your house down or anything else. If you follow the information contained here you do so entirely at your own risk. My views and opinions are my own and not necessarily represent the views of my employer. © Raheel Hameed and www.raheelhameed.com, 2017. Unauthorized use and/or duplication of this material without express and written permission from this site’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to author and this website with appropriate and specific direction to the original content.
Disclaimer: If you follow the information here, there is no warranty, I am not liable if it deletes your data, gets you hacked, burns your house down or anything else. If you follow the information contained here you do so entirely at your own risk. My views and opinions are my own and not necessarily represent the views of my current or former employers. © Raheel Hameed and www.raheelhameed.com, 2017. Unauthorized use and/or duplication of this material without express and written permission from this site’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to author and this website with appropriate and specific direction to the original content.
Comments
Post a Comment