How to gracefully shut down a server running in docker

I am starting mongodb via the ENTRYPOINT config in a docker file. It works fine. However, when I execute: docker stop <containerid> it seems to be sending a SIGTERM to the process. Which means the mongod.lock file is not cleared. How can I gracefully shutdown a running docker container so that the right signals are […]

Access Docker socket within container

I am attempting to create a container that can access the host docker remote API via the docker socket file (host machine – /var/run/docker.sock). The answer here suggests proxying requests to the socket. How would I go about doing this?

Can I get ip address inside my docker container?

How to get container ip address inside this container? ‘docker inspect $hostname …’ not suitable, because I don’t share /var/run/docker.sock host file to container.

Pulling docker images

Is there a way where I can manually download a docker image? I have pretty slow Internet connection and for me is better to get a link of the image and download it elsewhere with better Internet speed, How can I get the direct URL of the image managed by docker pull?

How to override the default value of COMPOSE_HTTP_TIMEOUT with docker-compose commnad

I have docker-compose which fetches some of the images and builds one. When I run docker-compose up , I am getting the following error ERROR: An HTTP request took too long to complete. Retry with –verbose to obtain debug information. If you encounter this issue regularly because of slow network conditions, consider setting COMPOSE_HTTP_TIMEOUT to […]

Setting DNS for Docker daemon on OS with systemd

The default DNS for Docker (e.g. 8.8.8.8) is blocked where I work, so I want to change the default. I’ve been able to do this using $ docker daemon –dns <mydnsaddress> but I want to do this using a systemd drop-in instead, since the official Docker docs recommend this way. I’ve made a /etc/systemd/system/docker.service.d/dns.conf file, […]

How do you add items to .dockerignore?

I’m not able to find many examples of what a .dockerignore file should look like. Using puppet to install a few packages on a docker container causes the image to explode from 600MB to 3GB. I’m trying to use a .dockerignore file to keep the size to a minumum $ cat Dockerfile FROM centos:centos6 #Work […]

Docker Error: push is already in progress

I’m trying to push a container that was interrupted previously by a network drop out. But I get this error: Error: push rimian/ruby-node-npm is already in progress But when I run docker ps I don’t see anything running. What shall I do?

How can I prevent a Dockerfile instruction from being cached?

In my Dockerfile I use curl or ADD to download the latest version of an archive like: FROM debian:jessie … RUN apt-get install -y curl … RUN curl -sL http://example.com/latest/archive.tar.gz –output archive.tar.gz … ADD http://example.com/latest/archive2.tar.gz … The RUN statement that uses curl or ADD creates its own image layer. That will be used as a […]

How can you run a Docker container if it doesn't exist yet, or start it if it does?

For instance if I have a run command like this: docker run –name yo -v “$(pwd)”:/usr/src/myapp -w /usr/src/myapp ubuntu sh tmp.sh If I run it again, it spits out this error: Error response from daemon: Conflict, the name yo is already assigned to c23849234e. You have to delete (or rename) that container to be able […]

Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.