← Home
📦

What is Docker and how to use Docker for installing Developer Utilities

A quick guide to install docker and know how to use it!

What is Docker?

Docker is a software that allows you to build, run, and share applications using containers. Containers are isolated environments that are expected to contain everything an application needs to run, such as the code, the dependencies, and the configuration. This way, you can ensure that your application runs the same way on any machine that has Docker installed, regardless of the underlying operating system or hardware.

$$ In \ a \ nut-shell, \ Docker = \ cgroups + namespaces + magic $$

image

Docker is useful for software engineers and enterprises who want to simplify and automate their development/deployment workflow.

What are Images and Containers?

Screenshot 2023-08-27 at 10.28.52 AM.png

What is Docker Hub?

Docker Hub is a public cloud-based registry that hosts thousands of pre-built images that you can use or customize for your own applications. More likely than not, you will find an image you can use for your application/code. Sign-up and create an account if you intend to upload/share the images you created.

Using Docker in brief

mermaid-diagram-2023-08-27-150647.svg

Docker Installation

To install Docker on your machine, you need to follow different steps depending on your operating system. Here are the steps for installing Docker on macOS, Windows, and Linux.

Install Docker on MacOS

  • Download the Docker Desktop for Mac installer.
  • Open the downloaded file and drag the Docker icon to the Applications folder.
  • Open the Docker app from the Applications folder and enter your password if prompted!
  • You can now use Docker commands in the Terminal app or use the Docker Dashboard to manage your containers.

Other

How to Use Docker for Installing Developer Utilities

Docker is a platform that allows you to run applications in isolated containers, which are like lightweight virtual machines. Docker can help you install and use developer utilities such as databases, caches, scripts, and more, without affecting your host system or other containers. Lets look at some examples of how to use Docker for installing developer utilities and mention some of their merits.

Benefits of Using Docker for Developer Utilities

One of the key benefits of using Docker for installing developer utilities is that you can easily switch between different versions of the same utility, or run multiple versions simultaneously.

This can help you test your applications with different environments or scenarios, or compare the performance and features of different versions.

While its out-of-scope for this blog to elucidate on the numerous benefits, key take away is that, using Docker can help simplify the process of installation, configuration and management of developer utilities/tools/dependencies.

Examples of Developer Utilities that You Can Install and Use with Docker

Some examples of developer utilities that you can install and use with Docker are:

  • MongoDB: a popular document-oriented database that stores data in JSON-like format. You can pull the official MongoDB image from Docker Hub and run it with a simple command:
docker run --name some-mongo -d mongo

This will start a MongoDB container with the latest version of MongoDB. If you want to use a specific version, you can specify the tag after the colon, such as mongo:4.4. You can also run multiple MongoDB containers with different versions or configurations on the same machine, as long as you use different names and ports.

  • NGINX: a powerful web server and reverse proxy that can handle high concurrency and load balancing. You can create a custom Dockerfile that copies your configuration files and web content into the NGINX image. Then you can build and run your image with the following commands:
docker build -t my-nginx . docker run --name some-nginx -p 80:80 -d my-nginx

This will create and start an NGINX container with your custom settings and content. You can also push your image to a registry like Docker Hub or GitHub Packages, and pull it from another machine or cloud service.

  • Redis: a fast and flexible in-memory data structure store that can be used as a cache, message broker, or database. You can pull the official Redis image from Docker Hub and run it with a simple command:
docker run --name some-redis -d redis

This will start a Redis container with the latest version of Redis. If you want to use a specific version, you can specify the tag after the colon, such as redis:6.2. You can also run multiple Redis containers with different versions or configurations on the same machine, as long as you use different names and ports.

  • Python: a versatile and popular programming language that can be used for web development, data analysis, machine learning, and more. You can create a custom Dockerfile that installs the Python packages that you need for your project. Then you can build and run your image with the following commands:
docker build -t my-python . docker run --name some-python -it my-python

This will create and start a Python container with your custom packages. You can also push your image to a registry like Docker Hub or GitHub Packages, and pull it from another machine or cloud service.

  • Jupyter Notebook: a web-based interactive environment that allows you to create and share documents that contain code, equations, visualizations, and text. You can use Jupyter Notebook for data analysis, machine learning, scientific computing, and more. You can pull the official Jupyter Notebook image from Docker Hub and run it with a simple command:
docker run --name some-notebook -p 8888:8888 -d jupyter/scipy-notebook

This will start a Jupyter Notebook container with the latest version of Jupyter Notebook and some popular scientific Python packages. You can access the notebook server from your browser by visiting http://localhost:8888 and entering the token that is printed in the container logs.

Visit the official documentation or check out some tutorials and examples.

  • VS Code: a powerful and lightweight code editor that supports multiple languages, extensions, debugging, and version control. You can use VS Code to edit, run, and debug your code in a fast and convenient way. You can pull the official VS Code image from Docker Hub and run it with a simple command:
docker run --name some-code -p 8080:8080 -d codercom/code-server

This will start a VS Code container with the latest version of VS Code and some popular extensions. You can access the code editor from your browser by visiting http://localhost:8080 and entering the password that is printed in the container logs.

  • GPT-3 Playground: a web-based interactive environment that allows you to explore the capabilities of GPT-3, a state-of-the-art natural language processing model. You can use GPT-3 Playground to generate text, answer questions, summarize documents, write code, and more. You can pull the GPT-3 Playground image from Docker Hub and run it with a simple command:

docker run –name some-playground -p 5000:5000 -d ak9250/gpt-3-playground

This will start a GPT-3 Playground container with the latest version of GPT-3 Playground and some sample queries. You can access the playground from your browser by visiting http://localhost:5000 and entering your OpenAI API key.

Conclusion

Docker is a great tool for installing and using developer utilities in a simple and consistent way. You can use Docker to run different versions of the same utility, or run multiple utilities on the same machine without interfering with each other. You can find more developer utilities on Docker Hub, or create your own images for your specific needs.

Try creating, building, running and using some docker images/containers and share with us what you liked! If you have any questions or feedback, please feel free to reach out to us.

#HappyDockering!

About Authors

Sai Manasa Ivaturi

Srinivas vaddi

Summary