Found 126 Articles for Docker

How to backup and restore a Docker Container?

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

2K+ Views

Docker allows us to automate the process of building and deploying an application. It also allows us to create a packaged environment to run the application which makes it easily portable and lightweight while also allowing us to keep track of the versions. All of these are possible through Docker Containers. It helps in making the applications platform independent.Let’s say we have a docker container running in our machine and we want to take a snapshot or keep a backup of that container so that in case of any emergency, if we want to roll back changes or execute a ... Read More

How to get a Docker Container IP address?

Raunak Jain
Updated on 27-Oct-2020 07:36:56

4K+ Views

We all know that we can run our application in a packaged environment called container using Docker. When you want containers to talk to each other, the network they create can be assumed to be a bridge network. Run the following command to get a list of networks.sudo docker network lsEach network of containers has a subnet mask and can be used to distribute IP addresses to its containers. This also means that each container in the docker network is assigned an IP address. The default subnet for a docker network is 172.17.0.0/16.Knowing these, we will now see the different ... Read More

Copy Files from Docker Container to Local Machine

Raunak Jain
Updated on 01-Oct-2020 16:15:06

3K+ Views

If you are working on a project that requires frequent copying of files and folders either from container to your local machine or from the local machine to the container, docker provides an easy and simple way to do that. If you have already built a docker image which is of large size and contains a large number of files and in the midst of the project you want to copy files to and from the container, it’s highly inefficient to put the files in the docker build context and build images repeatedly. Instead, docker allows easy copying of files ... Read More

Mounting a volume inside docker container

Raunak Jain
Updated on 01-Oct-2020 16:10:01

1K+ Views

In some projects, there might be scenarios where you have created multiple containers for different parts of the project and some of those containers share common files as well. Now, you want to create a shared directory between all the containers such that from all the containers you can access that directory or volume and perform changes in the files in that directory from any container.You can do so, be creating a volume and mounting it to all the containers. By doing so, all the containers will have shared access to the particular volume and you will be able to ... Read More

Build and deploy a flask application inside docker

Raunak Jain
Updated on 01-Oct-2020 16:00:05

661 Views

Docker allows you to build, manage and deploy applications inside containers. It provides a packed environment and allows developers to make portable applications by containerizing them. You can easily build a flask application, manage it and make it portable all using a single technology, docker. You can use similar techniques to build and deploy other python frameworks as well.In this article, we will be discussing how to build a simple application using flask and convert that into a docker image by containerizing it. You can follow the steps mentioned below to do the same.StepsCreate a new project folder. Let’s name ... Read More

Installing Linux Packages Inside a Docker Container

Raunak Jain
Updated on 01-Oct-2020 15:56:04

4K+ Views

After you have installed docker on your linux machine, the next step is to create an image and run a container. You need to create a base image of an OS distribution and after that you can add and modify the base image by installing packages and dependencies and committing the changes to it.In this article, we will show you how to create an ubuntu base image and on top of that create intermediate image layers by adding packages in it and keep committing the changes. We will update the ubuntu base image, install 3 packages - vim editor, firefox ... Read More

Combine multiple images using one dockerfile

Raunak Jain
Updated on 01-Oct-2020 15:45:23

5K+ Views

When you are working on a large project on docker, you need to go through certain phases of the development cycle. Maintaining a different dockerfile for each cycle such as build, release, testing etc. eats up a lot of resources and is highly inefficient when it comes to productivity.In the later versions of docker, it allows us to use what is called multi-stage Dockerfile with the help of two particular commands - FROM and AS.We can use multiple FROM commands combined with AS commands in our Dockerfile where the last FROM command will actually build the image. All the FROM ... Read More

RUN vs CMD vs Entrypoint in Docker

Raunak Jain
Updated on 01-Oct-2020 15:43:26

5K+ Views

The commands RUN, CMD and Entrypoint usually cause a lot of confusion among docker developers. Understanding all the three commands conceptually will help to have a clearer understanding of the same.When we try to build an image using dockerfile, the instructions are executed step by step. The first instruction is usually pulling a base image such as an OS distribution like ubuntu, centos etc. After that, we modify the base image either by including more images using FROM and AS commands or by modifying the images. Every such instruction creates a new intermediate image build and for each of them, ... Read More

Running GUI applications on docker in linux

Raunak Jain
Updated on 01-Oct-2020 15:38:45

536 Views

Suppose you are building an application that requires user interface and pops up a window on running the script. And let’s say you want to run that script inside a docker container. Now, you might expect the docker container to run the UI application for you and display the same on your screen. But using normal docker run commands, you won't be able to see or interact with the UI application. You need to connect the display with the container in order to do so. In this article, we will discuss how to do exactly the same.Here, we will see ... Read More

Using .Dockerignore file

Raunak Jain
Updated on 01-Oct-2020 15:31:29

5K+ Views

We know that we can run our docker images on cloud services which provide high computations in low cost prices. So, one might wonder why we need to optimize a docker image. Think of a situation where you have copied a large file in your docker container and you actually don’t need it. It’s obvious that it will increase the size of the docker image, it will increase the overall build time of the image and would cause a lot of caching issues as well. So, why not use a simple technique to avoid all these issues and improve the ... Read More

Advertisements