Questions tagged [docker-container]

Docker Containers are the core of the docker platform in which programs and applications can be packaged and run in simulated environments.

Docker containers are the core of the docker program in which programs and applications can run in simulated environments.

These containers serve as a way to simulate code that would otherwise cause irreversible changes to a systems hardware. The difference between this and a virtual machine is that the docker container does not run code on the same level as the virtual machine on top of the fact that it is a lot more portable.

Docker containers can be loaded with any type of environment, even your currently used machine, or serve as simple tool boxes for your file sytems.

For more info, see the official documentation of a docker container.

1187 questions
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
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
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
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
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
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
694
votes
17 answers

How to access host port from docker container

I have a docker container running jenkins. As part of the build process, I need to access a web server that is run locally on the host machine. Is there a way the host web server (which can be configured to run on a port) can be exposed to the…
Tri Nguyen
  • 9,950
  • 8
  • 40
  • 72
577
votes
13 answers

How to rebuild docker container in docker-compose.yml?

There are scope of services which are defined in docker-compose.yml. These services have been started. I need to rebuild only one of these and start it without up other services. I run the following commands: docker-compose up -d # run all…
yuklia
  • 6,733
  • 5
  • 20
  • 26
556
votes
23 answers

Docker container will automatically stop after "docker run -d"

According to tutorial I read so far, use "docker run -d" will start a container from image, and the container will run in background. This is how it looks like, we can see we already have container id. root@docker:/home/root# docker run -d…
J John
  • 5,591
  • 3
  • 11
  • 9
348
votes
11 answers

How to analyze disk usage of a Docker container

I can see that Docker takes 12GB of my filesystem: 2.7G /var/lib/docker/vfs/dir 2.7G /var/lib/docker/vfs 2.8G /var/lib/docker/devicemapper/mnt 6.3G /var/lib/docker/devicemapper/devicemapper 9.1G /var/lib/docker/devicemapper 12G …
AlonL
  • 6,100
  • 3
  • 33
  • 32
283
votes
14 answers

How to keep Docker container running after starting services?

I've seen a bunch of tutorials that seem do the same thing I'm trying to do, but for some reason my Docker containers exit. Basically, I'm setting up a web-server and a few daemons inside a Docker container. I do the final parts of this through a…
Eli
  • 36,793
  • 40
  • 144
  • 207
199
votes
10 answers

"image is being used by stopped container" error

I am trying to delete a docker image by this command: docker rmi Obviously, I have replaced the Image-Id by the Id I get using: docker images But I see the error below: Error response from daemon: conflict: unable to delete
Nick Mehrdad Babaki
  • 11,560
  • 15
  • 45
  • 70
199
votes
4 answers

How to assign more memory to docker container

As the title reads, I'm trying to assign more memory to my container. I'm using an image from docker hub called "aallam/tomcat-mysql" in case that's relevant. When I start it normally without any special flags, there's a memory limit of 2GB (even…
kane
  • 5,465
  • 6
  • 44
  • 72
185
votes
6 answers

What is the '--rm' flag doing?

I am trying Docker for the first time and do not yet have a "mental model". Total beginner. All the examples that I am looking at have included the --rm flag to run, such as docker run -it --rm ... docker container run -it --rm ... Question: Why do…
matchingmoments
  • 2,065
  • 2
  • 9
  • 7
174
votes
17 answers

Container is not running

I tried to start a exited container like follows, I listed down all available containers using docker ps -a. It listed the following: I entered the following commands to start the container which is in the exited stage and enter into the terminal…
Stranger
  • 10,332
  • 18
  • 78
  • 115
1
2 3
79 80