Thursday, 14 July 2016

Docker Devops Commands

Build images
$ docker-compose build
$ docker-compose build --no-cache

Show list of docker-compose processes
$ docker-compose ps                
$ docker ps -a 
$ docker stats [container name]

Remove all docker containers
$ docker rm $(docker ps -a -q)

Remove all docker images
$ docker rmi $(docker images -q)

Show All Images
$ sudo docker images

Some general commands
$ service docker start
$ service docker stop
$ service docker restart

$ docker-compose --version


Run
Run the docker-compose up command.



Edit a container

1. Login to container's shell with root user
$ docker run -it -u root web:latest /bin/bash

You will see a prompt like:
root@78e82f680994$

2. Make you changes in files etc.

3. Exit from shell

 $ exit

4. Commit changes in the container

$ docker commit <container ID> web:latest

here container id is  78e82f680994

so the command will br
$docker commit 78e82f680994 web:latest

 

No comments:

Post a Comment