Questions tagged [docker]

For questions about building and running Docker containers. DOCKER QUESTIONS MUST BE SPECIFICALLY RELATED TO SOFTWARE DEVELOPMENT. Suitable topics include Dockerfiles, Docker Compose, and architecture. As a rule of thumb, if your question is about something happening inside the container, it's probably on-topic here; if it's outside the container, it is probably off-topic.

The term docker usually refers to a set of open-source tools that allow developers to build and run containers individually or as a 'stack' of related containers. A container is an isolated package that contains everything, except for the kernel, needed to run a piece of software. Docker was initially written to work with Linux and has recently been implemented on MS Windows. Docker Inc. is the company behind the open-source docker toolset.

Docker builds a high-level API over execution drivers, such as OpenVZ, systemd-nspawn, libvirt-lxc, libvirt, QEMU/KVM, BSD Jails, Solaris Zones, and chroot to run processes with some degree of isolation and repeatability across environments. The default execution driver since release 0.9 is Docker's own libcontainer driver. It's mainly written in Go, and its source code can be found on Github. See Docker's official website for details.

For a docker installation on different operating systems such as Linux, Windows, or OS X, details can be found here; from this site, information about Docker under Windows, Mac or Linux distributions can be accessed. On Windows and OS-X, docker runs in a variety of VM.

Releases have three types: stable, edge and test. The latest stable version is given by the following badge (links to the corresponding release notes): docker:latest version

Note that since May 2017, docker is a product (split into CE and EE) built on top of the open-source project Moby. In November 2019, Docker Inc. sold its enterprise business and software to Mirantis. For more, see "Demystifying the Relationship Between Moby & Docker".

Where to ask

Questions on Stack Overflow must be programming-related; see the extended description in the help centre for more details. Questions about using Docker as a live development environment, mechanics of the Dockerfile system, and other questions that clearly involve application source code are generally welcome.

Questions about installing Docker or running prebuilt images are typically not programming-oriented and are not on-topic for Stack Overflow. Consider asking these questions on Super User, or a site more specific to your host operating system (Ask Ubuntu, Unix & Linux, Raspberry Pi Stack Exchange, Ask Different for macOS). Questions about using a Linux distribution package manager such as apt-get or apk are similarly inappropriate for Stack Overflow, even if they are otherwise in the context of a Dockerfile.

There are other container-management tools adjacent to Docker. In particular, is often used in combination with images produced with Docker. The tag should be used when a question is principally about native-Docker technologies, including and the build system; but omit if a question is principally about a Kubernetes YAML file or another adjacent technology and only includes a Docker image by reference.

Frequently asked questions

Where to start

  • Docker Curriculum: A comprehensive tutorial for getting started with Docker. Teaches how to use Docker and deploy dockerized apps on AWS with Elastic Beanstalk and Elastic Container Service.
  • Docker Documentation: the official documentation
  • Docker Training :heavy_dollar_sign:
  • Katacoda: Learn Docker using Interactive Browser-Based Labs
  • Learn Docker: a step-by-step tutorial and more resources (video, articles, cheat sheets) by @dwyl
  • Play With Docker: PWD is a great way to get started with Docker for beginner to advanced users. Docker runs directly in your browser.
  • Play With Moby: PWM is a web-based Moby playground which allows you to try different components of the platform in seconds. It gives you the experience of having a free Alpine Linux Virtual Machine in the cloud where you can build and run Moby projects and even create clusters to experiment.
  • Practical Introduction to Container Terminology The landscape for container technologies is more significant than just docker. Without a good handle on the terminology, It can be challenging to grasp the key differences between docker and (pick your favourites, CRI-O, rkt, lxc/lxd) or understand what the Open Container Initiative is doing to standardize container technology.
  • Docker Tutorial for Beginners (Updated 2019 version) — In this Docker tutorial, you'll learn all the basics and learn how you can containerize Node.js and Go applications. Even if you aren't familiar with these languages, it should be easy for you to follow this tutorial and use any other language.

Books

Development with Docker

API Client

CI/CD

  • Buddy:heavy_dollar_sign: - The best of Git, build & deployment tools combined into one powerful tool that supercharged our development.
  • Captain - Convert your Git workflow to Docker containers ready for Continuous Delivery by @harbur.
  • Cyclone - Powerful workflow engine and end-to-end pipeline solutions implemented with native Kubernetes resources by @caicloud.
  • Docker plugin for Jenkins - The aim of the docker plugin is to be able to use a docker host to dynamically provision a slave, run a single build, and then tear down that slave.
  • Drone - Continuous integration server built on Docker and configured using YAML files.
  • GitLab Runner - GitLab has integrated CI to test, build and deploy your code with the use of GitLab runners.
  • GOCD-Docker - Go Server and Agent in docker containers to provision.
  • Microservices Continuous Deployment - Continuous deployment of a microservices application.
  • mu - Tool to configure CI/CD of your container applications via AWS CodePipeline, CodeBuild and ECS @Stelligent
  • Screwdriver :heavy_dollar_sign: - Yahoo's OpenSource build platform designed for Continous Delivery.
  • Skipper - Easily dockerize your Git repository by @Stratoscale
  • SwarmCI - Create a distributed, isolated task pipeline in your Docker Swarm.
  • Watchtower - Automatically update running Docker containers by [@CenturyLinkLabs][centurylinklabs]

More resources

Related tags

133164 questions
4393
votes
24 answers

How is Docker different from a virtual machine?

I keep rereading the Docker documentation to try to understand the difference between Docker and a full VM. How does it manage to provide a full filesystem, isolated networking environment, etc. without being as heavy? Why is deploying software to a…
zslayton
  • 51,416
  • 9
  • 35
  • 50
3178
votes
42 answers

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

I have a Nginx running inside a docker container. I have a MySql running on the host system. I want to connect to the MySql from within my container. MySql is only binding to the localhost device. Is there any way to connect to this MySql or any…
Phil
  • 46,436
  • 33
  • 110
  • 175
2977
votes
16 answers

What is the difference between the 'COPY' and 'ADD' commands in a Dockerfile?

What is the difference between the COPY and ADD commands in a Dockerfile, and when would I use one over the other? COPY The COPY instruction will copy new files from and add them to the container's filesystem at path ADD…
Steve
  • 53,375
  • 33
  • 96
  • 141
2770
votes
27 answers

Copying files from Docker container to host

I'm thinking of using Docker to build my dependencies on a Continuous Integration (CI) server, so that I don't have to install all the runtimes and libraries on the agents themselves. To achieve this I would need to copy the build artifacts that…
user2668128
  • 39,482
  • 8
  • 27
  • 34
2631
votes
19 answers

What is the difference between CMD and ENTRYPOINT in a Dockerfile?

In Dockerfiles there are two commands that look similar to me: CMD and ENTRYPOINT. But I guess that there is a (subtle?) difference between them - otherwise it would not make any sense to have two commands for the very same thing. The documentation…
Golo Roden
  • 140,679
  • 96
  • 298
  • 425
2403
votes
51 answers

How to copy files from host to Docker container?

I am trying to build a backup and restore solution for the Docker containers that we work with. I have Docker base image that I have created, ubuntu:base, and do not want have to rebuild it each time with a Docker file to add files to it. I want to…
user3001829
  • 24,412
  • 5
  • 17
  • 21
2207
votes
21 answers

How to copy Docker images from one host to another without using a repository

How do I transfer a Docker image from one machine to another one without using a repository, no matter private or public? I create my own image in VirtualBox, and when it is finished I try to deploy to other machines to have real usage. Since it is…
Larry Cai
  • 55,923
  • 34
  • 110
  • 156
2187
votes
10 answers

Should I use Vagrant or Docker for creating an isolated environment?

I use Ubuntu for development and deployment and have a need for creating an isolated environment. I am considering either Vagrant or Docker for this purpose. What are the pros and cons, or how do these solutions compare?
murtaza52
  • 46,887
  • 28
  • 84
  • 120
2121
votes
56 answers

How to get a Docker container's IP address from the host

Is there a command I can run to get the container's IP address right from the host after a new container is created? Basically, once Docker creates the container, I want to roll my own code deployment and container configuration scripts.
Murali Allada
  • 21,718
  • 4
  • 19
  • 21
2040
votes
31 answers

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

I'm getting started working with Docker. I'm using the WordPress base image and docker-compose. I'm trying to ssh into one of the containers to inspect the files/directories that were created during the initial build. I tried to run docker-compose…
Andrew
  • 227,796
  • 193
  • 515
  • 708
1540
votes
10 answers

How to force Docker for a clean build of an image

I have build a Docker image from a Docker file using the below command. $ docker build -t u12_core -f u12_core . When I am trying to rebuild it with the same command, it's using the build cache like: Step 1 : FROM ubuntu:12.04 --->…
Pavan Gupta
  • 17,663
  • 4
  • 22
  • 29
1447
votes
66 answers

How to remove old Docker containers

This question is related to Should I be concerned about excess, non-running, Docker containers?. I'm wondering how to remove old containers. The docker rm 3e552code34a lets you remove a single one, but I have lots already. docker rm --help doesn't…
qkrijger
  • 26,686
  • 6
  • 36
  • 37
1309
votes
21 answers

How do I pass environment variables to Docker containers?

How can one access an external database from a container? Is the best way to hard code in the connection string? # Dockerfile ENV DATABASE_URL amazon:rds/connection?string
AJcodez
  • 31,780
  • 20
  • 84
  • 118
1220
votes
31 answers

What is the difference between a Docker image and a container?

When using Docker, we start with a base image. We boot it up, create changes and those changes are saved in layers forming another image. So eventually I have an image for my PostgreSQL instance and an image for my web application, changes to which…
Bibek Shrestha
  • 32,848
  • 7
  • 31
  • 34
1084
votes
31 answers

How to remove old and unused Docker images

When running Docker for a long time, there are a lot of images in system. How can I remove all unused Docker images at once safety to free up the storage? In addition, I also want to remove images pulled months ago, which have the correct TAG. So,…
Quanlong
  • 24,028
  • 16
  • 69
  • 79
1
2 3
99 100