-1

If I am running Boot2Docker on windows 7, and I connect to a container by running a command like docker run -it ubuntu:14.04 /bin/bash, how can I "disconnect" from the container and return the prompt to the boot2docker images command prompt?

Ideally I'd like to know both how to kill the container, and how to push the container into the background and then return it to the foreground later.

  • There a lot of incorrect assumptions in this question please go back and read the docs. You launch a container with docker run not connect to it. Docker container life-cycle is based on the life of the primary process. you can use ctrl + p + q to disconnect from a running container without killing it. There are docker kill and stop commands you can use to kill containers. – Usman Ismail Dec 29 '14 at 15:42
  • My apologies if I was not using the correct terminology, however ctrl-p-q works flawlessly, thank you. As a sidebar, the snark about going back to the docs is never helpful unless you link the relevant doc as well. If I'd found the relevant doc, I wouldn't be asking here. –  Dec 31 '14 at 02:20
  • https://docs.docker.com/userguide/dockerizing/ Most of the questions you asked are referenced in the first chapter of the user guide. – Usman Ismail Dec 31 '14 at 15:14

1 Answers1

1

What you seem to be looking for is the -d option for the docker run command which starts the container on background. You can then access the container easily with command like this (found from Timur Fayzrakhmanov's answer on AskUbuntu)

sudo docker exec -i -t <your_id> bash

where you replace the your_id with something like 665b4a1e17b6.

Community
  • 1
  • 1
Roope Hakulinen
  • 7,326
  • 4
  • 43
  • 66