Mudanças entre as edições de "Docker"

De MochilaWiki
Ir para navegaçãoIr para pesquisar
 
(3 revisões intermediárias pelo mesmo usuário não estão sendo mostradas)
Linha 47: Linha 47:
 
docker ps -a
 
docker ps -a
 
</source>
 
</source>
 +
 +
kill all running containers with
 +
docker kill $(docker ps -q)
 +
 +
delete all stopped containers with
 +
docker rm $(docker ps -a -q)
 +
 +
delete all images with
 +
docker rmi $(docker images -q)
 +
 +
apagando uma imagem
 +
docker rmi <IMAGE ID>
 +
 +
atualiza forçando sem o cache
 +
docker-compose -f docker-compose.prod.yml build --no-cache
 +
 +
Show docker disk usage
 +
docker system df
 +
 +
Get real time events from the server
 +
docker system events
 +
 +
Display system-wide information
 +
docker system info
 +
 +
Remove unused data
 +
docker system prune
 +
 +
=== apagando container ===
 +
<source lang="bash">
 +
docker stop <Container_ID>
 +
docker rm -f < Container_ID>
 +
</source>
 +
 +
 +
 +
* https://www.digitalocean.com/community/tutorials/como-instalar-e-usar-o-docker-no-ubuntu-18-04-pt
 +
* https://docs.docker.com/install/linux/docker-ce/debian/
 +
 +
Copiar arquivos de um container para uma máquina local
 +
docker cp <containerId>:/file/path/within/container /host/path/target
 +
 +
* https://stackoverflow.com/questions/22049212/docker-copying-files-from-docker-container-to-host

Edição atual tal como às 14h45min de 15 de junho de 2023

Debian Stretch

apt install apt-transport-https dirmngr
echo deb https://apt.dockerproject.org/repo debian-stretch main > /etc/apt/sources.list.d/docker.list
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys F76221572C52609D
apt update
apt install docker-engine

Fonte: https://www.vivaolinux.com.br/dica/Como-instalar-o-Docker-no-Debian-9-Stretch

Debian Jessie

sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get install apt-transport-https ca-certificates -y

sudo sh -c "echo deb https://apt.dockerproject.org/repo debian-jessie main > /etc/apt/sources.list.d/docker.list"
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

sudo apt-get update
sudo apt-cache policy docker-engine
sudo apt-get install docker-engine -y

sudo service docker start
sudo docker run hello-world

sudo group add docker
sudo groupadd docker
sudo gpasswd -a $USER docker
sudo service docker restart

comandos

entrando no bash num container chamando ubuntu

docker run -it ubuntu bash

containers rodando

docker ps

todos os containers

docker ps -a

kill all running containers with

docker kill $(docker ps -q)

delete all stopped containers with

docker rm $(docker ps -a -q)

delete all images with

docker rmi $(docker images -q)

apagando uma imagem

docker rmi <IMAGE ID>

atualiza forçando sem o cache

docker-compose -f docker-compose.prod.yml build --no-cache

Show docker disk usage

docker system df

Get real time events from the server

docker system events

Display system-wide information

docker system info

Remove unused data

docker system prune

apagando container

docker stop <Container_ID>
docker rm -f < Container_ID>


Copiar arquivos de um container para uma máquina local

docker cp <containerId>:/file/path/within/container /host/path/target