To start using Docker, I installed Docker on my machine. At first Docker was only available on Ubuntu. But now Docker engine is supported on Cloud, OS X and Windows as well. Docker can be installed on Mac or Windows using boot2docker by downloading tiny core Linux VM.
Installing Docker for Ubuntu
Log into the Ubuntu installation as a user with sudo privilegesMake sure all your list of packages from all repositories and PPA's is up to date.
$ sudo apt-get update
Download and install Docker.$ sudo apt-get install -y docker.io
Then verify that Docker has been installed correctly.$ sudo docker version
If you have installed Docker successfully, above command should pop up details about the client and the server.Then I ran the 'Hello-world' image.
So what happens when we run this command?
- Docker checks for the presence of the hello-world image locally on the host. Since the image does not exist locally, Docker tries to download or pull the latest hello-world image from Docker Hub. Each line which indicates 'Pull complete' ensures that each layer of the image is pulled successfully. These layers may correspond to installing some prerequisites for the application to run.
- Then it creates a new container. Once Docker has the image, it uses it to create a container. A container is created in the file system and a read-write layer is added to the image.
- Then it creates a network interface that allows Docker container to talk to the local host.An IP address is attached.
- After that application is executed. In this scenario, a message 'Hello from Docker' is displayed. If that message pops up, we can ensure that installation of Docker has been completed successfully.
docker : This tells the operating system that you are using the Docker program
run : This is a sub command that creates and runs a docker container
hello-world : This tells Docker which image to load into the container
Working with images
The key to start working with any docker container is using images. There are many freely available images shared across docker image index and the command line interface allows simple access to query the image repository and to download new ones.
Docker help : If you are struggled to find out what commands to use with Docker, type docker help or docker and it will provide all the basic Docker commands as follows.
List images : If you want to list the images that are locally available in your host, use the command sudo docker images and the details of the available images will be shown.
Search images : If you want to search for a specific image, use the command below. For eg: If you enter the command, docker search ubuntu, it will display a very long list of available images matching the query 'ubuntu'.
sudo docker search <image-name>
Commit images : Committing makes sure that everything continues from where they left next time you use one.
Download images : If you are to build a container, you need to have an image at the host machine. If the image is not available in the host, Docker has to download or pull the image from the Docker Hub.
sudo docker pull <image-name>
sudo docker commit <container-ID> <image-name>
Push images : Once we have created our own container, we can sign up at Docker Hub and then we can push our images to Docker Hub so that we can share them with rest of the world.
sudo docker push <user-name / image-name>
sudo docker push <user-name / image-name>
Working with containers
Create a new container : To create a new container, we need to use a base image and specify a command to run.
sudo docker run <image-name> <command-to-run>
sudo docker run <image-name> <command-to-run>
Run a container : We can get a stopped container to run using this command.
sudo docker run <container-id>
Stop a container : Stop a container's process from running.sudo docker run <container-id>
sudo docker stop <container-id>
Delete a container : Delete an existing container.
sudo docker rm <container-id>
List the running containers.
sudo docker psDocker Pros
- Extreme application portability
- Very easy to create and work with derivative.
- Fast boot on containers.
Docker Cons
- Host-centric solution
- No higher level provisioning
- No usage tracking or reporting
ReplyDeleteNice Article!!!
Docker and Kubernetes Training
Docker Training
Docker Online Training
Kubernetes Online Training
Docker Training in Hyderabad
Thank you for sharing wonderful information with us to get some idea about that content.
ReplyDeleteMicroservices Online Training
Microservices Training in Hyderabad
Hey, What's up, I'm Shivani. I'm an application developer living in Noida, INDIA. I am a fan of technology. I'm also interested in programming and web development. You can download my app with a click on the link. Talk to astrologer
ReplyDeleteAndroidiOSZone is a leading Mobile app development company in Delhi. where our dedicated team members provide world-class technology solutions to game the competitive market. Share your app idea and Contact Us At 91-9899130284
ReplyDelete
ReplyDeletetrung tâm tư vấn du học canada vnsava
công ty tư vấn du học canada vnsava
trung tâm tư vấn du học canada vnsava uy tín
công ty tư vấn du học canada vnsava uy tín
trung tâm tư vấn du học canada vnsava tại tphcm
công ty tư vấn du học canada vnsava tại tphcm
điều kiện du học canada vnsava
chi phí du học canada vnsava
#vnsava
@vnsava
Hey, What's up, I'm Shivani. I'm an application developer living in Noida, INDIA. I am a fan of technology. I'm also interested in programming and web development. You can download my app with a click on the link. Best astrology app
ReplyDeleteAstro guru online
Best astrologer
Talk to astrologer
Onlne astrologer
Online pandit
Online astrologer in delhi NCR
Cool Post on docker.
ReplyDeleteAWS Training in Chennai
Congratulation for the great post. I ended up on your site looking for article on Horse Breeds. I noticed that you certainly do have excellent and creative ideas on the topic. Great read.
ReplyDeleteThanks for sharing this informative content , Great work
ReplyDeleteLeanpitch provides online training in Enterprise agile coaching during this lockdown period everyone can use it wisely.
Enterprise agile coaching
Thanks for sharing this informative content , Great work
ReplyDeleteRead this blog to know about : Definition of done
Thank you for sharing wonderful information
ReplyDeleteServiceNow Training in Ameerpet
ServiceNow Course Online
Very Interesting post, must have a look.
ReplyDeleteDevOps Tutorial for Beginners, Devops Free Training Online
Kubernetes Tutorial – Full Kubernetes Course for Beginners
Ansible Tutorial for Beginners, Online Ansible Free Training
Docker Tutorial for Beginners, Online Docker Free Training
Openstack Tutorial for Beginners, Openstack training Online
How to Install Kubernetes Cluster on Ubuntu 20.04 LTS
Top 50 DevOps Interview Questions and Answers
DevOps Interview Questions and Answers
Learn Linux, DevOps and Cloud