Monday, 31 December 2018

How to run Docker containers ?


Run a Docker container
1. NON INTERACTIVE MODE
It can be executed as a one time command (Non-interactive)
here, Container dies after execution.
$ sudo docker run unbuntu:14.04 /bin/echo 'Hello docker'
It searches and runs ubuntu image locally present or if not found, search this image in repository.


2. INTERACTIVE MODE
It can also be run in Interactive mode, where container is present for more execution until we exit the container.
$ sudo docker run -t -i unbuntu:14.04 /bin/bash
root@76889898:/#  pwd
root@76889898:/#  ls
....

root@76889898:/#  exit



To check list of running containers
$ docker ps


No comments:

Post a Comment

Note: only a member of this blog may post a comment.