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.

  • Dockerfile and Rails Error
  • Using Java To run a shell script to copy a file to docker returns an error
  • Why does deploying on Kubernetes take so long?
  • Ansible: 'item' is undefined
  • Docker container from docker cloud on windows
  • Docker container mongod error when starting via ssh
  • 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.

  • How to mount a directory in docker container to host
  • Docker Run error with ENTRYPOINT
  • Deploy docker-compose to swarm
  • docker, maven start failed: Connection is still allocated
  • How can I mount a container file to my Docker host?
  • Communicate nodeJs with symfony rabbitMq
  • 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.