Herramientas de usuario

Herramientas del sitio


wiki2:docker-new

Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Ambos lados, revisión anterior Revisión previa
Próxima revisión
Revisión previa
wiki2:docker-new [2018/12/17 08:23]
alfred [Executing commands]
wiki2:docker-new [2022/02/20 10:54] (actual)
Línea 21: Línea 21:
 ''​docker start <​container id>''​ ''​docker start <​container id>''​
  
 +=== Create an image and run a command over it without starting ===
 +<​code>​
 +docker build -f dockerfile.app -t coop .
 +docker run -ti coop python ​
 +</​code>​
 ==== Info about containers ==== ==== Info about containers ====
  
Línea 37: Línea 42:
 ''​docker logs <​container id>''​ ''​docker logs <​container id>''​
  
 +First, if you just need to see less output, you can have docker only show you the more recent lines:
 +<​code>​docker logs --since 30s -f <​container_name_or_id></​code>​
 +Or you can put a number of lines to limit:
 +<​code>​docker logs --tail 20 -f <​container_name_or_id></​code>​
 ==== Stop containers ==== ==== Stop containers ====
  
Línea 66: Línea 75:
   - ''​Ps''​ the id if required.   - ''​Ps''​ the id if required.
   - ''​Kill''​ the id.   - ''​Kill''​ the id.
 +
 +<​code>​
 +docker build --build-arg http_proxy=http://​192.168.40.110:​3128 -t svn .
 +LASTID=`docker run -d -p 80:80 svn`
 +docker exec -ti $LASTID sh
 +docker kill $LASTID
 +</​code>​
 ==== Images ==== ==== Images ====
 +=== List images ===
 +<​code>​
 +docker images
 +docker images debian
 +</​code>​
 +
 === Build the Dockerfile in the current path === === Build the Dockerfile in the current path ===
 <​code>​ <​code>​
Línea 86: Línea 108:
 </​code>​ </​code>​
  
 +
 +=== Rename o re-tagging an image ===
 +<​code>​docker tag server:​latest myname/​server:​latest</​code>​
 +or
 +<​code>​docker tag d583c3ac45fd myname/​server:​latest</​code>​
  
 === Basic commands with images === === Basic commands with images ===
Línea 91: Línea 118:
 docker image ls docker image ls
 docker image --all # o -a, show intermediate images docker image --all # o -a, show intermediate images
-docker image prune # removes the unused+docker image prune  
 +docker image prune -a # removes the unused
 docker image inspect # shows info about the image docker image inspect # shows info about the image
 +</​code>​
 +
 +==== Stats and info ====
 +<​code>​
 +docker stats
 +</​code>​
 +Info of sizes:
 +<​code>​
 +docker system df -v
 +</​code>​
 +Info about containers:
 +<​code>​
 +docker ps --size
 </​code>​ </​code>​
 ===== Docker compose ===== ===== Docker compose =====
Línea 120: Línea 161:
 </​code>​ </​code>​
 Then: ''​env DJANGO_SETTINGS_MODULE=OpenAwards.settings.production docker-coompose up''​ Then: ''​env DJANGO_SETTINGS_MODULE=OpenAwards.settings.production docker-coompose up''​
 +
 +
 +===== Shortcuts =====
 +Imaginemos que tienes un Dockerfile sin **CMD** definido, podrías construir el contenedor con:
 +<​code>​
 +docker build -f Dockerfile.svn -t svn .
 +</​code>​
 +Y luego correr dentro de él con:
 +<​code>​
 +docker run -ti svn sh
 +</​code>​
wiki2/docker-new.1545035031.txt.gz · Última modificación: 2020/05/09 09:25 (editor externo)