In our last article we talked about dockers and containters. Here we are going to say do hello world in docker. For this we need to install docker and see few basic commands of docker.
Hello World with Docker
You can download docker from here https://www.docker.com/docker-ubuntu. Or you can also use these instructions to install docker in your ubuntu.
Also install Kitematic as this will give you an ui to manage and change settings of your docker conatiners.
For docker to work we need to make a Dockerfile which contains info what to run in container. Create a docker file
Now open this file in you favourite editor and paste the following in Dockerfile.
FROM alpine CMD echo "hello-world"
After saving the file run the below command to build your container. This command will download required containers from docker hub and use them. You will see some output like the below after these commands.
Now that you have build your container. Its time to run it.
docker run hello
Docker will run your container and then you can see the output in your terminal.
You can also do all these using Kitematic. Below is the screenshot of the kitematic dashboard.
Here you can see your containers listed. Also there are many other options like start, restart, stop also settings in top right corner. It container options related to network, volumes, Host port etc.
Now that you have seen hello world in Docker, try experimenting with it and comment in below if you are stuck some where. I am also a beginner but I will try to find solution for your problem.
More articles on Docker and containers will be coming soon. Follow this blog to get status of any new articles.
To access articles related to docker follow the below link.
This is the end of Hello World with Docker.