Need advice about which tool to choose?Ask the StackShare community!

Docker

178.3K
143.3K
+ 1
3.9K
Terraform

18.8K
14.7K
+ 1
344
Add tool

Docker vs Terraform: What are the differences?

Docker is a containerization platform that simplifies the process of packaging and deploying applications, while Terraform is an infrastructure as code tool used for provisioning and managing cloud resources in a declarative manner. Let's explore the key differences between them.

  1. Container Orchestration vs Infrastructure Provisioning: Docker is primarily used for containerization and container orchestration. It allows developers to package their applications and their dependencies into containers, making it easy to deploy and manage them across different environments. Terraform, on the other hand, is an infrastructure provisioning tool. It enables users to define and provision infrastructure resources, such as servers, networks, and storage, in a way that can be easily managed and automated.

  2. Scope: Docker focuses on the deployment and management of applications within containers. It provides a lightweight runtime environment that is isolated from the underlying operating system, making it easier to develop and deploy applications. Terraform, on the other hand, focuses on the provisioning and management of infrastructure resources. It allows users to define and provision infrastructure as code, enabling consistent and repeatable deployments.

  3. Technology Stack: Docker is built on containerization technology, using containers to package and distribute applications and their dependencies. It relies on a container runtime engine, such as Docker Engine, to run these containers. Terraform, on the other hand, is a cloud-agnostic technology. It can be used to provision infrastructure resources on a wide range of cloud providers, including AWS, Azure, Google Cloud, and more.

  4. State Management: Docker does not have a built-in state management system. Each container is isolated and runs independently. Docker containers can be managed and orchestrated using tools like Docker Compose and Kubernetes. Terraform, on the other hand, has built-in state management. It maintains a state file that keeps track of the current state of the infrastructure. This allows Terraform to understand the changes that need to be made to the infrastructure and apply them accordingly.

  5. Use Case: Docker is commonly used for building, packaging, and deploying applications, especially in microservices architectures. It provides a lightweight and efficient way to package applications and their dependencies, making it easier to deploy and scale them. Terraform, on the other hand, is used for infrastructure provisioning and management. It enables users to define and manage infrastructure resources, making it easier to automate infrastructure deployments and ensure consistency across environments.

  6. Community Support and Ecosystem: Docker has a large and active community with a wide range of tools and libraries built around it. This includes popular tools like Docker Compose, Docker Swarm, and Kubernetes, which provide additional functionality for managing and orchestrating Docker containers. Terraform also has a strong community and ecosystem, with support for a wide range of cloud providers and resources. It integrates well with other infrastructure tools and frameworks, making it easy to use alongside existing workflows and technologies.

In summary, Docker focuses on container orchestration and application deployment, while Terraform focuses on infrastructure provisioning and management. Docker uses containers to package and distribute applications, while Terraform provides infrastructure as code for provisioning and managing resources. Docker is commonly used for building and deploying applications, while Terraform is used for automating and managing infrastructure deployments.

Decisions about Docker and Terraform
Kirill Shirinkin
Cloud and DevOps Consultant at mkdev · | 3 upvotes · 156K views

Ok, so first - AWS Copilot is CloudFormation under the hood, but the way it works results in you not thinking about CFN anymore. AWS found the right balance with Copilot - it's insanely simple to setup production-ready multi-account environment with many services inside, with CI/CD out of the box etc etc. It's pretty new, but even now it was enough to launch Transcripto, which uses may be a dozen of different AWS services, all bound together by Copilot.

See more

Because Pulumi uses real programming languages, you can actually write abstractions for your infrastructure code, which is incredibly empowering. You still 'describe' your desired state, but by having a programming language at your fingers, you can factor out patterns, and package it up for easier consumption.

See more
Sergey Ivanov
Overview

We use Terraform to manage AWS cloud environment for the project. It is pretty complex, largely static, security-focused, and constantly evolving.

Terraform provides descriptive (declarative) way of defining the target configuration, where it can work out the dependencies between configuration elements and apply differences without re-provisioning the entire cloud stack.

Advantages

Terraform is vendor-neutral in a way that it is using a common configuration language (HCL) with plugins (providers) for multiple cloud and service providers.

Terraform keeps track of the previous state of the deployment and applies incremental changes, resulting in faster deployment times.

Terraform allows us to share reusable modules between projects. We have built an impressive library of modules internally, which makes it very easy to assemble a new project from pre-fabricated building blocks.

Disadvantages

Software is imperfect, and Terraform is no exception. Occasionally we hit annoying bugs that we have to work around. The interaction with any underlying APIs is encapsulated inside 3rd party Terraform providers, and any bug fixes or new features require a provider release. Some providers have very poor coverage of the underlying APIs.

Terraform is not great for managing highly dynamic parts of cloud environments. That part is better delegated to other tools or scripts.

Terraform state may go out of sync with the target environment or with the source configuration, which often results in painful reconciliation.

See more

I personally am not a huge fan of vendor lock in for multiple reasons:

  • I've seen cost saving moves to the cloud end up costing a fortune and trapping companies due to over utilization of cloud specific features.
  • I've seen S3 failures nearly take down half the internet.
  • I've seen companies get stuck in the cloud because they aren't built cloud agnostic.

I choose to use terraform for my cloud provisioning for these reasons:

  • It's cloud agnostic so I can use it no matter where I am.
  • It isn't difficult to use and uses a relatively easy to read language.
  • It tests infrastructure before running it, and enables me to see and keep changes up to date.
  • It runs from the same CLI I do most of my CM work from.
See more

Context: I wanted to create an end to end IoT data pipeline simulation in Google Cloud IoT Core and other GCP services. I never touched Terraform meaningfully until working on this project, and it's one of the best explorations in my development career. The documentation and syntax is incredibly human-readable and friendly. I'm used to building infrastructure through the google apis via Python , but I'm so glad past Sung did not make that decision. I was tempted to use Google Cloud Deployment Manager, but the templates were a bit convoluted by first impression. I'm glad past Sung did not make this decision either.

Solution: Leveraging Google Cloud Build Google Cloud Run Google Cloud Bigtable Google BigQuery Google Cloud Storage Google Compute Engine along with some other fun tools, I can deploy over 40 GCP resources using Terraform!

Check Out My Architecture: CLICK ME

Check out the GitHub repo attached

See more
Florian Sager
IT DevOp at Agitos GmbH · | 3 upvotes · 478.1K views
Chose
LXDLXD
over
DockerDocker

lxd/lxc and Docker aren't congruent so this comparison needs a more detailed look; but in short I can say: the lxd-integrated administration of storage including zfs with its snapshot capabilities as well as the system container (multi-process) approach of lxc vs. the limited single-process container approach of Docker is the main reason I chose lxd over Docker.

See more
Praveen Mooli
Engineering Manager at Taylor and Francis · | 19 upvotes · 4.1M views

We are in the process of building a modern content platform to deliver our content through various channels. We decided to go with Microservices architecture as we wanted scale. Microservice architecture style is an approach to developing an application as a suite of small independently deployable services built around specific business capabilities. You can gain modularity, extensive parallelism and cost-effective scaling by deploying services across many distributed servers. Microservices modularity facilitates independent updates/deployments, and helps to avoid single point of failure, which can help prevent large-scale outages. We also decided to use Event Driven Architecture pattern which is a popular distributed asynchronous architecture pattern used to produce highly scalable applications. The event-driven architecture is made up of highly decoupled, single-purpose event processing components that asynchronously receive and process events.

To build our #Backend capabilities we decided to use the following: 1. #Microservices - Java with Spring Boot , Node.js with ExpressJS and Python with Flask 2. #Eventsourcingframework - Amazon Kinesis , Amazon Kinesis Firehose , Amazon SNS , Amazon SQS, AWS Lambda 3. #Data - Amazon RDS , Amazon DynamoDB , Amazon S3 , MongoDB Atlas

To build #Webapps we decided to use Angular 2 with RxJS

#Devops - GitHub , Travis CI , Terraform , Docker , Serverless

See more
Manage your open source components, licenses, and vulnerabilities
Learn More
Pros of Docker
Pros of Terraform
  • 823
    Rapid integration and build up
  • 692
    Isolation
  • 521
    Open source
  • 505
    Testa­bil­i­ty and re­pro­ducibil­i­ty
  • 460
    Lightweight
  • 218
    Standardization
  • 185
    Scalable
  • 106
    Upgrading / down­grad­ing / ap­pli­ca­tion versions
  • 88
    Security
  • 85
    Private paas environments
  • 34
    Portability
  • 26
    Limit resource usage
  • 17
    Game changer
  • 16
    I love the way docker has changed virtualization
  • 14
    Fast
  • 12
    Concurrency
  • 8
    Docker's Compose tools
  • 6
    Easy setup
  • 6
    Fast and Portable
  • 5
    Because its fun
  • 4
    Makes shipping to production very simple
  • 3
    Highly useful
  • 3
    It's dope
  • 2
    Package the environment with the application
  • 2
    Super
  • 2
    Open source and highly configurable
  • 2
    Simplicity, isolation, resource effective
  • 2
    MacOS support FAKE
  • 2
    Its cool
  • 2
    Does a nice job hogging memory
  • 2
    Docker hub for the FTW
  • 2
    HIgh Throughput
  • 2
    Very easy to setup integrate and build
  • 0
    Asdfd
  • 121
    Infrastructure as code
  • 73
    Declarative syntax
  • 45
    Planning
  • 28
    Simple
  • 24
    Parallelism
  • 8
    Well-documented
  • 8
    Cloud agnostic
  • 6
    It's like coding your infrastructure in simple English
  • 6
    Immutable infrastructure
  • 5
    Platform agnostic
  • 4
    Extendable
  • 4
    Automation
  • 4
    Automates infrastructure deployments
  • 4
    Portability
  • 2
    Lightweight
  • 2
    Scales to hundreds of hosts

Sign up to add or upvote prosMake informed product decisions

Cons of Docker
Cons of Terraform
  • 8
    New versions == broken features
  • 6
    Unreliable networking
  • 6
    Documentation not always in sync
  • 4
    Moves quickly
  • 3
    Not Secure
  • 1
    Doesn't have full support to GKE

Sign up to add or upvote consMake informed product decisions

- No public GitHub repository available -

What is Docker?

The Docker Platform is the industry-leading container platform for continuous, high-velocity innovation, enabling organizations to seamlessly build and share any application — from legacy to what comes next — and securely run them anywhere

What is Terraform?

With Terraform, you describe your complete infrastructure as code, even as it spans multiple service providers. Your servers may come from AWS, your DNS may come from CloudFlare, and your database may come from Heroku. Terraform will build all these resources across all these providers in parallel.

Need advice about which tool to choose?Ask the StackShare community!

What companies use Docker?
What companies use Terraform?
Manage your open source components, licenses, and vulnerabilities
Learn More

Sign up to get full access to all the companiesMake informed product decisions

What tools integrate with Docker?
What tools integrate with Terraform?

Sign up to get full access to all the tool integrationsMake informed product decisions

Blog Posts

PythonDockerKubernetes+7
3
1231
PythonDockerKubernetes+14
12
2736
Jul 9 2019 at 7:22PM

Blue Medora

DockerPostgreSQLNew Relic+8
11
2460
DockerAmazon EC2Scala+8
6
2846
What are some alternatives to Docker and Terraform?
LXC
LXC is a userspace interface for the Linux kernel containment features. Through a powerful API and simple tools, it lets Linux users easily create and manage system or application containers.
rkt
Rocket is a cli for running App Containers. The goal of rocket is to be composable, secure, and fast.
Kubernetes
Kubernetes is an open source orchestration system for Docker containers. It handles scheduling onto nodes in a compute cluster and actively manages workloads to ensure that their state matches the users declared intentions.
Cloud Foundry
Cloud Foundry is an open platform as a service (PaaS) that provides a choice of clouds, developer frameworks, and application services. Cloud Foundry makes it faster and easier to build, test, deploy, and scale applications.
Vagrant
Vagrant provides the framework and configuration format to create and manage complete portable development environments. These development environments can live on your computer or in the cloud, and are portable between Windows, Mac OS X, and Linux.
See all alternatives