Difference between revisions of "Docker"

From RHS Wiki
Jump to navigation Jump to search
Line 17: Line 17:
 
  #  Remove incompletely built images:
 
  #  Remove incompletely built images:
 
  docker images | grep none | awk '{print "docker rmi " $3;}' | sh
 
  docker images | grep none | awk '{print "docker rmi " $3;}' | sh
 +
 +
= Restart stopped container with diferent command =
 +
Find your stopped container id
 +
docker ps -a
 +
Commit the stopped container:
 +
This command saves modified container state into a new image user/test_image
 +
docker commit $CONTAINER_ID user/test_image
 +
Start/run with a different entry point:
 +
docker run -ti --entrypoint=sh user/test_image

Revision as of 14:08, 24 May 2017

Install

curl -sSL https://get.docker.com/ | sh
docker pull python:2.7
docker run -i -t python:2.7
docker docker run -i -t python:2.7 bash
docker ps -a
docker pull linuxkonsult/kali-metasploit
docker search kali
docker images
docker run -i -t linuxkonsult/kali-metasploit bash

# Remove all containers
docker rm $(docker ps -aq)  

#  Remove incompletely built images:
docker images | grep none | awk '{print "docker rmi " $3;}' | sh

Restart stopped container with diferent command

Find your stopped container id

docker ps -a

Commit the stopped container: This command saves modified container state into a new image user/test_image

docker commit $CONTAINER_ID user/test_image

Start/run with a different entry point:

docker run -ti --entrypoint=sh user/test_image