Vagrant managed docker container doesn't start

I’ve been trying to write a vagrant file to start up my docker container to run a small web app I’ve been writing. However when I try use vagrant up I eventually get an error saying

The container started either never left the "stopped" state or
very quickly reverted to the "stopped" state. This is usually
because the container didn't execute a command that kept it running,
and usually indicates a misconfiguration.

If you meant for this container to not remain running, please
set the Docker provider configuration "remains_running" to "false":

  config.vm.provider "docker" do |d|
    d.remains_running = false

I’m very new to vagrant so I’m not really sure what the best way to try and fix the problem is.

  • How do i migrate mysql data directory in docker container?
  • docker pull gets me the error: “Download failed, retrying: x509: certificate signed by unknown authority”
  • Docker root access to host system
  • Docker copy files to and mount same folder
  • Docker doesn't download images (connection problems to registry)
  • Nginx as reverse proxy for docker containers
  • My vagrant file contains

    Vagrant.configure("2") do |config|
      config.vm.synced_folder "thelibrary", "/thelibrary"
      config.vm.provider "docker" do |d|
        d.image           = "django-dev"
        d.has_ssh         = false
        d.ports           = ["8000:8000"]
        d.cmd = ["python", "/thelibrary/", "runserver", ""]

    I’m not sure why it says the command doesn’t keep running. I can run the docker container with the same command and it will spin up my django app without any issues.

  • Minor change in ansible playbook does not get updated in target host
  • ERROR:tornado.general:WebSocket … Swampdragon : DoesNotExist: matching query does not exist
  • How can I list tags of a given image using docker-py?
  • Docker GUI with Mac how to
  • Starting a docker container with a node.js app produces error; complains about PATH
  • How to run docker image as singleton
  • One Solution collect form web for “Vagrant managed docker container doesn't start”

    I spent the day try to get the docker machine running.. finally got it working. Here is what I have in my vangrantfile, hope this can at least get you started:

    config.vm.provider :docker do |d|
        d.image = "paintedfox/postgresql" = "db"
        d.cmd = ["/sbin/my_init", "--enable-insecure-key"]

    vagrant status returns me this:

    Current machine states:
    dev running (docker)

    Another solution that you can try is to remove all your existing images and start fresh, it could be that your image is broken.

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