Docker Commands

Get a Docker Image

docker pull ubuntu

Run a Docker Container

docker run -d -ti -v /data--name=Odoo /bin/bash
d = Detach mode
t = Terminal
i = Interactive
v = attach volume
Run /bin/bash in container when it starts.

Enter into a Docker Container

docker attach odoo : Enter to container odoo

Quit from a container without stopping it

Ctrl+P+Q : Quit without stopping the running process from the container

Attach a Volume

docker run -d -ti -v /srv/data1:/data --name=Odoo1 /bin/bash
Create Odoo1 container and mount host's /srv/data1 to /data of Odoo1 container

List all Containers in the host

docker ps -a: List all Running /Not running containers

Start/Stop Container

docker start odoo : Start the container (Exited)
docker stop odoo: Stop container

Expose a Port
docker run -d -p 3306:3306 -ti mysql /bin/bash

Start the container mysql and open port 3306 and map it to localport 3306

Networking
docker network ls
docker network inspect bridge

List all the ports

iptables -L -t nat
docker run -it -p 80:8080 -d --restart=always --name shipyard --link shipyard-rethinkdb:rethinkdb shipyard/shipyard
Advertisements

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: