Skip to content
Sébastien LUCAS edited this page Jan 6, 2016 · 21 revisions

Docs

Official packages

Selected Tuto

How to

List active docker containers

docker ps -l

Output

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                           NAMES
00bb4123c87d        nginx               "nginx -g 'daemon off"   57 minutes ago      Up 57 minutes       0.0.0.0:32769->80/tcp, 0.0.0.0:32768->443/tcp   mysite

Connect to an ubuntu image

docker run -t -i ubuntu /bin/bash

Run and build a docker image

First build the container

```docker build -t my-apache2 .````

  • docker command
  • build docker command
  • -t option to give a name : my-apache2 -t, --tag= Repository name (and optionally a tag) for the image
  • . read the content of a docker file in the current directory

Then run it

docker run --name=apache -i -t my-apache2

  • docker command
  • run docker command
  • --name=apache option to set the name of the container (the running container,not the saved image)

docker run + the image name you would like to run + the command to run within the container

It's important to note that containers are designed to stop once the command executed within them has exited. For example, if you ran /bin/echo hello world as your command, the container will start, print hello world and then stop:

WIKI by Sébastien Lucas CEO & Funder or Bricks

Clone this wiki locally