DEV Community

What is docker?

Ahmed Khaled MOhamed on January 02, 2018

Collapse
 
davids89 profile image
David

Docker is a software that lets you to setup an app like a running part of your device. It's like a virtual machine but lighter. A docker container get the resorces by the local system so it's not a operative system by himself.

With a Docker container you can determinate the versions of the dependencies, so you will not have a version issue in the future.

Also, is great to make a deploy, so it is working in local it will do it in the server

Collapse
 
aaahmedaa profile image
Ahmed Khaled MOhamed

so is there a difference between docker and the virtualenv in python or do i just compared the un-comparing stuff ?

Collapse
 
blardo profile image
Anthony Blardo™

Virtualenv provides dependency isolation for a specific programming language - it lets you use different versions of Python and keep the pip packages you want located within the project space you setup.

Docker is a similar concept in that it keeps things isolated, but it steps down a tier lower in the stack. Docker lets you build containers that are effectively smaller operating systems in a can that can leverage the host OS's resources through the Docker daemon.

You can create a Dockerfile that creates a container which installs Python, installs the pip dependencies using a Pipfile inside the container, and then run the app using that container all without causing an impact to the local filesystem on the machine that is executing the container.

A Docker container's only contract to the outside world is exposing a port to allow traffic to communicate into the service inside of the container.

Thread Thread
 
kayis profile image
K

Is it a good idea to use this for front-end dev-environments?

I had some issues with npm and nodejs versions back in the days, would be nice if I could create a something stable that would minimize dev-env setup and would always build my stuff.

Thread Thread
 
davids89 profile image
David

Yes, it's perfect to make isolated projects and configure a specific version of dependecies.

Thread Thread
 
kayis profile image
K

Does Docker for Mac work with Xcode (cli stuff)?

Thread Thread
 
davids89 profile image
David

I use it in Mac with the terminal to use the cli

Thread Thread
 
kayis profile image
K

I want to build iOS apps with the Xcode cli tools and fastlane, that's why I'm asking :)

Thread Thread
 
davids89 profile image
David

By the official website

Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications, whether on laptops, data center VMs, or the cloud.

Collapse
 
davids89 profile image
David

The virtualenv is a enviroment to install some dependencies. With Docker you can simulate a machine without using a virtual operative system.

Thread Thread
 
kalyanik1 profile image
Kalyanik1

Hi David,

I am trying to install hyper-ledger framework on aws server.As the server is being shared by multiple users I have been asked to do installations within my pip virtual env.

Now for Hyperledger , docker is one of the prerequisites , so should I install docker within virtualenv or install docker in root and then create virtual env?

Or if docker is there I do not need to use virtual env and docker will take care of separate environments.
Purpose of Virtual env here is only to maintain separate workspace.

Thread Thread
 
davids89 profile image
David

You can create a docke for every environment

Collapse
 
marksasp95 profile image
Marco Suárez

Is it something like NPM?

Collapse
 
kayis profile image
K • Edited

It has some functionality like npm.

It can install images from docker repositories like docker hub. Which is a bit like installing npm packages.

The difference is that npm packages are plain directories and files that live beside your app. The images also isolate your app from the rest of the OS, while providing general software (applications & libraries, not only JS packages) for your application to use.

Also one image could deliver basics of a Ubuntu system, then a Nginx image could extend that Ubuntu image with added libraries and Nginx preinstalled and then you would extend the Nginx image with the your html&css that the preinstalled Nginx should serve.

Collapse
 
davids89 profile image
David

No it doesn't. NPM is a package manager, only to install some libraries. With Docker you are simulating a machine, installing software like Ubuntu dependencies and configuring your project.

Collapse
 
msoedov profile image
Alex Miasoiedov • Edited

Docker is a toolkit for creating, running and shipping containers and images on Linux system.

Docker image is a filesystem snapshot, packed version of all files required to run some process (application).

Docker container is a process (application) which executes from files and environment packed into docker image

Docker is not a VM, it shares Linux kernel with other processes. It's just a restricted environment for execution of a process.

Collapse
 
jasursaribaev profile image
jasursaribaev

What is

Collapse
 
mathur_anurag profile image
Anurag Mathur 

A very good introduction is available on youtu.be/YFl2mCHdv24