-2

I've create an Ubuntu container in docker (on windows 10) like the following:

> docker run --name omuntu -it ubuntu

After that, I installed some packages in that named container such as python. Then, exited from the container by exit command. Now, the question is How can I start the named container again, some how run commands inside its bash and access to my previous installed packages?

I should have mentioned that docker start omuntu just run the service and I get the following on docker ps:

CONTAINER ID        IMAGE               COMMAND             CREATED             
STATUS              PORTS               NAMES
932a2859c1ca        ubuntu              "/bin/bash"         36 minutes ago      Up 3 seconds                            
omuntu

But I cannot run the command such as I've ran for the first time, as an instance , this command:

root@932a2859c1ca:/# python -V
OmG
  • 18,337
  • 10
  • 57
  • 90
  • 2
    Possible duplicate of [How restart a stopped docker container](https://stackoverflow.com/questions/39666950/how-restart-a-stopped-docker-container) – Grimmy Jul 25 '17 at 13:30
  • @jww Of course this post is related to development (development on ubuntu in windows docker). For example see this post: https://stackoverflow.com/questions/11828270/how-to-exit-the-vim-editor Also, there are many posts similar to this. – OmG Jul 25 '17 at 15:33
  • My apologies. I fail to see what running your favorite lightweight VM has to do with Stack Overflow. Question about your favorite lightweight VM belong elsewhere, just like VMware and VirtualBox belong elsewhere. As far as I know, the Docker tag description states Docker API. Folks should probably avoid making the leap to "all docker questions". – jww Jul 25 '17 at 15:40
  • @jww Anyhow, you can't draw a clear line between development and the path to the development. As I said, there are a lot of similar posts which are asked and answerd, and faved by many users in many communities in SO. In addition, DockerApi is a different tag with Docker. Also, there are other different tags relatedto the docker on SO. – OmG Jul 25 '17 at 15:48
  • Well, good luck with things... – jww Jul 25 '17 at 15:51

1 Answers1

0

You should using two default false options --attach, -a and --interactive, -i such as below:

> docker start -ai omuntu

After that, you will get:

root@932a2859c1ca:/#

Now, you can run your command inside the Ubuntu container. Of course, the installed packages are available in this container. See more options here.

OmG
  • 18,337
  • 10
  • 57
  • 90