Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by Raunak Jain
Page 3 of 8
How to copy files from host to Docker container?
If you have a Docker container running and you want to copy files from the host machine to the Docker container, there are several ways to do it. One way to do this is by using the ADD or COPY instructions inside a Dockerfile and passing the paths of the files that you want to be in your container when you start it. But what happens if you already have a container running? It's not feasible to build the same image again and again just for a small file to be included in it. To avoid this fiasco, Docker ...
Read MoreCreate a simple Numpy Jupyter Notebook using Docker
Machine learning and Data Science have become essential technologies in modern computing. Organizations adopt Data Analytics and Machine Learning techniques to predict sales and increase revenue. If you want to build machine learning models in a dynamic and contained environment, Docker containers provide an excellent solution. You can build and run Machine Learning models easily inside Docker Containers with the help of Jupyter Notebooks. The containerized environment provides better version control of your Python or R libraries and packages used in Machine Learning projects. In this article, we will discuss how to create a simple NumPy Jupyter Notebook ...
Read MoreWorking with Docker Swarm
Docker Swarm is a container orchestration tool that enables you to manage a cluster of Docker nodes as a single virtual system. It provides native clustering functionality for Docker containers, allowing you to deploy and scale applications across multiple machines while maintaining high availability and load balancing. In a Docker Swarm cluster, there are two types of nodes: manager nodes that control the cluster and make orchestration decisions, and worker nodes that run the actual containers. The swarm manager handles scheduling, load balancing, and service discovery automatically. Docker Swarm operates in two service modes: Replicated Service mode where ...
Read MoreHow to deal with persistent storage (e.g. databases) in Docker?
Docker volumes provide a robust solution for persistent storage in Docker containers. Unlike bind mounts, which depend heavily on the host's directory structure, volumes are completely managed by Docker and offer better portability and control. When using volumes, Docker creates a new directory within its storage directory on the host machine. This approach is superior to persisting data on the container's writable layer because volumes don't increase container size and their contents exist independently of the container's lifecycle. Advantages of Docker Volumes Portability − Easier to migrate or back up across different environments Management − Simple ...
Read MoreDocker host network vs bridge network
Docker provides two primary single-host networking modes: host and bridge networks. Single-host networks operate locally on each individual Docker host, providing different levels of network isolation and connectivity options. In host networking, Docker containers share the host's network stack directly, eliminating network isolation between container and host. With bridge networking, containers run in an isolated network namespace and require explicit port mapping to communicate with external systems. Host Network Mode Host networking allows containers to use the host's network interface directly. This mode provides maximum performance but sacrifices network isolation. Creating a Container with Host Network ...
Read MoreHow to edit a file after I shell to a Docker container?
When working with Docker containers, you may need to edit files directly inside the container after accessing its shell. This is common during debugging, configuration changes, or quick fixes. There are multiple approaches to achieve this, depending on whether you need a temporary solution or want to prepare an image with pre-installed editors. Accessing a Container Shell First, you need to access the container's shell. There are two main scenarios: Creating a New Container with Shell Access To create and run a new Ubuntu container with interactive shell access: $ docker run -it --name=mycont ...
Read MoreUser defined bridge on Docker network
A user-defined bridge network in Docker provides enhanced networking capabilities compared to the default bridge network. It allows containers to communicate using container names instead of IP addresses, offers better isolation, and provides more flexible network management options. Advantages of User-Defined Bridge Networks User-defined bridge networks offer several key benefits over default bridge networks: Name-based communication − Containers can access each other using names or aliases instead of IP addresses Better isolation − Only containers within the same user-defined network can communicate with each other Dynamic connectivity − Containers can be connected or disconnected from networks ...
Read MoreHow to force a clean build of a Docker Image?
When you execute the Docker pull command or Docker run command, the daemon first checks for a similar image in the local machine by comparing the digests of the image. If it finds a match, then it's not required to search the registry for the image and the daemon can simply create a copy of the already existing image. However, if a copy is not found, it starts pulling it from the registry. The same is the case when you try to build images using a Dockerfile. We all know that Docker images are multi-layered files containing multiple image ...
Read MoreRunning Docker Container as a Non Root User
When you run an application inside a Docker Container, by default it has access to all the root privileges. You might have noticed that when you open an Ubuntu Docker Container bash, you are logged in as the root user by default. This can prove to be a major security concern for your application. Any unauthorized access can compromise the entire container along with all the files and applications running inside it. Hence, it becomes very important to perform operations as a non-root user wherever possible. In this article, we will discuss two methods to run Docker containers as ...
Read MoreHow to get a Docker container's IP address from the host?
If you are working with Docker for a long time now, you might already have lots of containers running in your host machine. At times, it becomes really difficult to keep track of all these containers. Moreover, if you are on a network or using compose, there might be several containers running inside the network. In such a case, determining which container is actively running and which has failed, is very difficult. You might need to ping these containers periodically to check their status. For this, you need to have the IP addresses of the containers. You can easily ...
Read More