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
1068
votes
34 answers

How to fix docker: Got permission denied issue

I installed Docker in my machine where I have Ubuntu OS. When I run: sudo docker run hello-world All is ok, but I want to hide the sudo command to make the command shorter. If I write the command without sudo docker run hello-world That displays…
Carlos Andres
  • 12,740
  • 7
  • 18
  • 34
1066
votes
15 answers

How to deal with persistent storage (e.g. databases) in Docker

How do people deal with persistent storage for your Docker containers? I am currently using this approach: build the image, e.g. for PostgreSQL, and then start the container with docker run --volumes-from c0dbc34fd631 -d app_name/postgres IMHO,…
juwalter
  • 11,472
  • 5
  • 19
  • 18
1056
votes
32 answers

Exploring Docker container's file system

I've noticed with docker that I need to understand what's happening inside a container or what files exist in there. One example is downloading images from the docker index - you don't have a clue what the image contains so it's impossible to start…
user2668128
  • 39,482
  • 8
  • 27
  • 34
1023
votes
31 answers

Where are Docker images stored on the host machine?

I managed to find the containers under directory /var/lib/docker/containers, but I can't find the images. What are the directories and files under /var/lib/docker?
nemo
  • 12,241
  • 3
  • 21
  • 26
965
votes
14 answers

How to list containers in Docker

There's a command to list images, docker images, but there doesn't seem to be a corresponding docker containers. Other than becoming root and looking into /var/lib/docker there doesn't seem a way to do that. Am I missing something? Is that something…
w00t
  • 17,944
  • 8
  • 54
  • 62
934
votes
27 answers

How can I delete all local Docker images?

I recently started using Docker and never realized that I should use docker-compose down instead of ctrl-c or docker-compose stop to get rid of my experiments. I now have a large number of unneeded docker images locally. Is there a flag I can run…
Kimmo Hintikka
  • 13,472
  • 7
  • 34
  • 63
928
votes
21 answers

Docker Compose - How to execute multiple commands?

I want to do something like this where I can run multiple commands in the following code: db: image: postgres web: build: . command: python manage.py migrate command: python manage.py runserver 0.0.0.0:8000 volumes: - .:/code ports: …
RustyShackleford
  • 25,262
  • 6
  • 22
  • 38
924
votes
5 answers

What is the difference between ports and expose in docker-compose?

What is the difference between ports and expose options in docker-compose.yml?
Bibek Shrestha
  • 32,848
  • 7
  • 31
  • 34
889
votes
17 answers

Error "The input device is not a TTY"

I am running the following command from my Jenkinsfile. However, I get the error "The input device is not a TTY". docker run -v $PWD:/foobar -it cloudfoundry/cflinuxfs2 /foobar/script.sh Is there a way to run the script from the Jenkinsfile without…
Anthony
  • 33,838
  • 42
  • 169
  • 278
885
votes
27 answers

How to mount a host directory in a Docker container

I am trying to mount a host directory into a Docker container so that any updates done on the host is reflected into the Docker containers. Where am I doing something wrong. Here is what I did: kishore$ cat Dockerfile FROM ubuntu:trusty RUN apt-get…
Kishore
  • 9,146
  • 3
  • 13
  • 11
881
votes
20 answers

How does one remove a Docker image?

I'm running Docker under Vagrant under OS X 10.8.4 (Mountain Lion), and whenever I try to delete a saved image, I get an error: $ docker rmi some-image-id 2013/07/15 hh:mm:ss unexpected JSON input According to the rmi help, the proper syntax is…
Jules
  • 14,200
  • 13
  • 56
  • 101
870
votes
14 answers

Docker how to change repository name or rename image?

I'm trying to change repository name of the image: REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE server latest d583c3ac45fd 26 minutes ago 685.5 MB Hence I want to…
Timur Fayzrakhmanov
  • 17,967
  • 20
  • 64
  • 95
832
votes
20 answers

How to include files outside of Docker's build context?

How can I include files from outside of Docker's build context using the "ADD" command in the Docker file? From the Docker documentation: The path must be inside the context of the build; you cannot ADD ../something/something, because the first…
ben_frankly
  • 9,270
  • 3
  • 18
  • 22
795
votes
15 answers

How to see docker image contents

I did a docker pull and can list the image that's downloaded. I want to see the contents of this image. Did a search on the net but no straight answer.
pylearn
  • 8,119
  • 4
  • 11
  • 12
795
votes
69 answers

denied: requested access to the resource is denied: docker

I am following this link to create my first docker Image and it went successfully and now I am trying to push this Image into my docker repository from this link. But whenever I am trying to push this Image into repository, I got this type of…
Keyur Shah
  • 11,043
  • 4
  • 29
  • 48