Docker allows you to package your applications and send them to the cloud. Although we usually build one app using the Docker platform, this does not mean that you cannot have multiple apps with their own repositories. Our apps don’t have to be exactly built and deployed. There are many benefits to Docker when it comes to building and deploying apps.
- A group of containers can be cached.
- Scalability – Many containers can be placed on a single host
- Your service can be run on hardware that is significantly cheaper than standard servers
- Rapid deployment, easy creation of new instances, and quicker migrations.
- You get better security and less access to the code inside containers. There are also fewer software dependencies.
Instead of building every application individually and distributing them separately, like with Heroku, CloudFront, or Google App Engine, we use Docker containers to build many of our applications.
Here are our best picks for the top Docker images you must know about:
WordPress is an open-source blogging tool that’s free and available to all. It also has a content management system (CMS), based on PHP/MySQL and runs on a web host. WordPress features include a template system and a plugin architecture. WordPress was used by over 22.0% of top 10,000,000 websites in August 2013. More than 60,000,000 websites use WordPress now.
WordPress is also available on Docker Hub. To pull the image, use the command below. Docker will download the most recent version if the version is not specified.
# docker pull wordpress
WordPress container can also take environment variables and Docker parameters.
- -e WORDPRESS_DB_PASSWORD= Set the same database password here.
- -name WordPress – Gives the container its name.
- -link WordPressdb:mysql- Link the WordPress container to the MariaDB container, so that applications can interact.
- -p 80.80 – This tells Docker to connect from the HTTP port of your server to the container’s internal port 80.
- -v “$PWD/html”:/var/www/html – Sets the WordPress files accessible from outside the container. Even if the container is removed, volume files will still be available.
- -d – Allows the container to run in the background
- wordpress – This tells Docker what to do. This uses the package that was downloaded with the docker pull wordpress command.
Ubuntu, a Debian-based Linux operating platform, runs on all devices. It is the most widely used operating system in public clouds and OpenStack clouds. Ubuntu is the most popular platform for containers. Ubuntu can run containers on a large scale using everything from Docker to Kubernetes and LXD. Ubuntu powers millions upon millions of computers around the world. It is fast, secure, and easy to use.
Ubuntu image is based on official rootfs tarballs from Canonical. Since this is the recommended version for general use, the ubuntu:latest tag refers to the “latest LTS”. The ubuntu:rolling tag refers to the most recent release, regardless of LTS status.
Run the following command to pull docker images from dockerhub:
# docker pull Ubuntu
Ubuntu is the most popular Docker image in the industry. It is Ubuntu’s official OS and serves as the base image for almost every server OS. It is a compact, lightweight image that can be used to build upon. It is simple to expand this image and add the resources needed for each task.
MySQL is the most widely used open-source database in the world. MySQL is the most popular open-source database for web-based applications. It has been proven to be reliable, performant, and easy-to-use. MySQL can be used for personal projects, websites, e-commerce, and information services. Many more.
You have two options: Download a specific version, or download the most recent release.
# sudo docker pull mysql/mysql-server:latest
You can modify the configuration of your MySQL instance when you start mysql by using the docker run command line.
- MYSQL_ROOT_PASSWORD – Specifies the password to be used for the MySQL root superuser account
- MYSQL_DATABASE : This allows you to specify the name for a database that will be created using image startup.
- MYSQL_ALLOW_EMPTY_PASSWORD: Set to a non-empty value, like yes, to allow the container to be started with a blank password for the root user.
- MYSQL_USER and MYSQL_PASSWORD are used in conjunction to create a user and set their password.
A new database will be created when a container starts for the first time. It will also initialize with the configuration variables. Furthermore, it will execute files with extensions .sh, .sql and .sql.gz that are found in /docker-entrypoint-initdb.d.
MongoDB, a cross-platform open-source document-oriented database program, is free and freely available. MongoDB is a NoSQL database software that uses JSON-like documents and schemata. MongoDB Inc. developed MongoDB and published it under the Apache License and Server Side Public License.
Docker Hub’s official image contains the MongoDB community edition and is maintained by Docker. This image is suitable for use in a development environment. For production environments, a container custom-built with the Enterprise version or MongoDB Atlas is recommended. MongoDB can be run in a container.
The following command will pull the docker images:
# docker pull mongo
The command below will allow you to run MongoDB within a docker container.
# docker run –name some-mongo -d mongo:tag
Docker Compose can be used to stop and start MongoDB containers and applications running on the same machine. Docker Compose is best suited for testing or development environments that don’t require the full functionality of MongoDB Enterprise and MongoDB Atlas.
Nginx, pronounced “enginex”, is an open-source reverse proxy server that supports HTTP, HTTPS and SMTP protocols. It also includes a load balancer and HTTP cache. The original nginx project was focused on high concurrency and high performance, as well as low memory usage.
NGINX Open Source images from Docker Hub can be used to create an instance of NGINX in a Docker container. This command will launch NGINX in a container using the default NGINX configuration.
# docker run –name mynginx1-p 80:80-d nginx
This command creates a new container called mynginx1 using the NGINX image. The command returns the long container ID.
Docker will map the port in the container that was exposed by NGINX to port 80 to the Docker host using the -p option. The first parameter specifies which port is in the Docker host. The second parameter maps to the port that’s in the container. The -d option indicates that the container is in detached mode. This means that it runs until stopped but doesn’t respond to commands on the command line.
So, that was all about how to get started with top Docker container images. These are the best options that are available on dockerhub. You have many more docker container image options on dockerhub, you can pull and run them as pe your need. Docker is a great platform for quick and easy development, shipping, and deployment of software and is packaged in any location from home to office to production.