Found 120 Articles for Docker

How do I pass environment variables to Docker containers?

Raunak Jain
Updated on 06-Aug-2021 11:34:16

1K+ Views

Suppose you are using a MySQL Docker container and you want to pass environment variables to your container while running the container. It’s always a good idea to isolate the services from the configuration and it’s always advised to use environment variables for this purpose.Predominantly, there are three different ways through which we can pass environment variables to our Docker containers. These are by using the -e, --env-file, and the ENV instruction inside the Dockerfile. Let’s check out all these methods one by one with examples.Passing environment variables using the --env or -e flagTo demonstrate this example, let’s use the ... Read More

How do I get into a Docker container's shell?

Raunak Jain
Updated on 06-Aug-2021 11:32:03

15K+ Views

Once you have your Docker container up and running, you can work with the environment of the Docker container in the same way you would do with an Ubuntu machine. You can access the bash or shell of the container and execute commands inside it and play around with the file system. You can build, test, and deploy your applications inside the container itself.Predominantly, there are 3 ways to access the shell of a running container. These are -Using the Docker run command to run a container and access its shell.Using the Docker exec command to run commands in an ... Read More

From inside of a Docker container, how do I connect to the localhost of the machine

Raunak Jain
Updated on 06-Aug-2021 11:28:12

13K+ Views

Suppose you have an Nginx web server running inside an Nginx container in your host machine. And you have a MySQL database running in your host machine. Now, you want to access the MySQL server in your host machine from the Nginx container. Also, the MySQL is running on your localhost and the host machine does not expose any port to the outside world. Hence, we can conclude that MySQL is bound to be run on localhost only and not accessible to the outside world because it is not bound on the IP address.In this article, we will explain the ... Read More

Copying files from Docker container to Host

Raunak Jain
Updated on 06-Aug-2021 11:26:49

2K+ Views

We can use the Docker build command to build Docker images using a build context. The build context contains all the files which are required to create your containerized application environment. This includes the Dockerfile to build the Docker images, source code of the application, Dockerignore files, all the files, and directories that you want to be there beforehand in the container when you run it.However, it often happens that you might want to copy some files from the container to the host machine. For example, if you are working on an application inside a Docker container and you have ... Read More

Top skills that would be handy before taking up a technical role

Raunak Jain
Updated on 27-Oct-2020 08:15:35

48 Views

Getting through all the tedious interview rounds of big tech giants for internships and jobs is in itself a big task. But once you clear the interview rounds and secure a job or an internship, the journey does not end there. In fact, this will be the time you need to upskill yourself in order to keep up with the pace of shift in technological stacks that the tech industry goes throughIn this article, we will be discussing top skills that would be very handy if you would learn it before taking up the job or internship position. We will ... Read More

Running Docker Container as a Non Root User

Raunak Jain
Updated on 27-Oct-2020 08:09:27

6K+ Views

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 concern in terms of security of the application. Any outsider can misuse this and hack the entire Container along with all the other files and applications running inside the Docker Container. Hence, it becomes very important to perform most of the trivial operations as a non root user wherever possible.In this ... Read More

Creating a MySQL Docker Container

Raunak Jain
Updated on 27-Oct-2020 08:07:38

373 Views

One of the most important features of Docker Containerization is that it creates a bounded environment for running the Application with all the necessary dependencies and packages installed. Most applications require a backend database to store data points. Oracle provides Docker Images for running MySQL inside Containers and thus it becomes an excellent choice for testing your database applications. It provides lightweight MySQL Image instances with cleanup features once your testing is completed.Docker allows you to download the Image containing the MySQL binaries and dependencies and creates a virtual filesystem. Note that if you start a Docker Container with the ... Read More

User defined bridge on Docker network

Raunak Jain
Updated on 27-Oct-2020 08:06:27

822 Views

In this article, we are going to discuss why you should use a user-defined bridge network over default bridge networks. We will also demonstrate the same using practical examples.If you use a user−defined bridge for Container networking, all the Containers in that network automatically exposes all the required ports to each other but not to the external world. This increases interoperability among the containers and provides better isolation.When you create Docker Containers using the default bridge network, accessing each other can only be done using IP addresses. But in case of user-defined bridge networks, you can access them using names ... Read More

Docker host network vs bridge network

Raunak Jain
Updated on 27-Oct-2020 08:04:58

5K+ Views

There are two types of single−host networks available for Docker Networking - “host” and “bridge” networks. Single−host networks mean that their effect is local to each individual host.In case of a host network, a particular Docker Container can directly use the Networking of the host for sending and receiving the packets. In the case of a bridge network, it requires port mapping to communicate.To understand them better, let’s create a nginx container with the help of host networking. Before creating a nginx container, let’s list all the available networks.sudo docker network lsYou will find a network with the name host ... Read More

Working with Docker Swarm

Raunak Jain
Updated on 27-Oct-2020 08:03:07

719 Views

If you are working on a microservice architecture, where you need to work on different project components on different machines and create a master slave architecture where the master nodes control the slave nodes, deploying your project through Docker Swarm might save you a lot of time, effort and resources.Docker Swarm is basically a cluster of physical or virtual machines called nodes which run docker containers separately and you can configure all these nodes to join a cluster managed by the master node called the swarm manager. It is an orchestration tool which allows you to manage multiple Docker Containers ... Read More

Advertisements