My linux world » Docker Manage

Docker Manage


Contents

List available subcommands

docker

Display system-wide information

docker info

List the images that have been downloaded to your computer

docker images

List active containers

docker ps

List all (actives and inactives) containers

docker ps -a

Docker remove image

docker rmi centos:latest

Note : you can see the image:tag list using the command ‘docker images’

Docker run command on container

#print debian /etc/issue
docker run debian cat /etc/issue

Docker destroy all Containers and Images

# Stop all containers
docker stop $(docker ps -a -q)
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)

Get a shell on a running container

# by id
docker exec -i -t df571832c97c /bin/bash
 
# by name
docker exec -i -t prettyname /bin/bash

Docker save image

docker save mariadb -o /opt/docker/mysavedimagesql

Docker import saved image

docker import /opt/docker/mysavedimagesql

Copyright © 2024 My linux world - by Marc RABAHI
Design by Marc RABAHI and encelades.