Found 1383 Articles for Open Source

Important instructions used in dockerfile

Raunak Jain
Updated on 27-Oct-2020 07:42:46

2K+ Views

We all know the importance of dockerfile in creating an efficient and flexible Docker Image. A dockerfile contains a set of instructions that are executed step by step when you use the docker build command to build the docker image. It contains certain instructions and commands that decides the structure of your image, the amount of time taken to build the image, contains instructions related to docker build context, contains information related to the packages and libraries to be installed in the container and many more. Hence, it becomes very important to create an efficient, reusable, clean dockerfile as it ... Read More

Working with Docker Volumes

Raunak Jain
Updated on 27-Oct-2020 07:40:54

923 Views

To define Docker Volumes, they are file systems that can be mounted on Docker containers. They help in preserving the data and are independent of the container life cycle. One of the major advantages of Docker Volumes is that it allows the developers to backup their data and also allows easy sharing of file systems among Docker containers. We can easily mount a volume when we launch a Docker container. It is also possible to mount the same volume to different containers and this allows easy sharing of data between them and this can be easily achieved with the use ... Read More

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

949 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

502 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

3K+ 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

4K+ 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

Advertisements