In this post we will see how to create a docker container of ubuntu on your windows laptop.
Pre-requisites:-
I am using “Docker for Windows” software to run dockers on my Windows 10 laptop. You can get “Docker for Windows” by clicking on this link .
If you have Windows 7 download Docker Toolbox for Windows with Virtualbox.
Ubuntu docker creation
Once you are done with docker installation let’s move ahead.
- In the windows command prompt or in “Docker Quickstart Terminal” execute below command. By default it will pull the latest image of ubuntu container available in repository.
C:\CloudVedas>docker run ubuntu
- If you need specific version of Ubuntu you can mention the version name in command. Like below we are pulling Ubuntu 14.04 version. You can check all the available versions here .
- Now let’s see the image we have downloaded .
- Let’s create a container with that image using the image id. Here we are using -d option so that the container runs in detached mode and we can login to it.
- List the running containers using “docker container ls”
We can see our container is created 5 minutes ago and is up. You can also identify the container using the container id. Note that the container ID is same as the first 12 digits of the string we got when we executed docker run in last step.
- Let’s get inside our container and check it.
Once you are inside the Ubuntu container you can explore it. Let’s check the OS version.
root@b77f35f8840e:~# more /etc/os-release NAME="Ubuntu" VERSION="14.04.5 LTS, Trusty Tahr" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 14.04.5 LTS" VERSION_ID="14.04" HOME_URL="http://www.ubuntu.com/" SUPPORT_URL="http://help.ubuntu.com/" BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/" root@b77f35f8840e:~#
- If you don’t see your container up, it may have stopped automatically. To check all the containers which are/were running, execute command
C:\CloudVedas>docker ps -a
You can also create your own customized container image which you can use to deploy more containers in your environment. Refer this post on how to create a container image.
Hope this post helped you. Do let me know if you have any query or you get stuck in any installation step.