DEBIAN PRO

DEBIAN PRO
DEBIAN

miércoles, 18 de octubre de 2017

Docker run exec


Un muy buen post sobre Docker y las maneras de arrancar procesos en Contenedores.

https://chankongching.wordpress.com/2017/03/17/docker-what-is-the-different-between-run-and-exec/

Here are some command ref:

To use binaries in a docker images:
docker run #{image} "COMMAND to be Ran"

To use binaries in a docker images continuously(setting or configs need to be inherited):
docker run #{image} --name #{container_name}

To enter a docker images and run command interactively:
docker run -it #{image}

To start a docker in background(as daemon)with process up and running that defined in Dockerfile:
docker run -d --name #{container_name} #{image}



Agrego mis recetas recolectadas (que suelo tener a mano)


https://github.com/wsargent/docker-cheat-sheet
docker pull alpine
docker images
docker inspect alpine

docker create - creates a container but does not start it.
docker rename - allows the container to be renamed.
docker run - creates and starts a container in one operation.
docker rm - deletes a container.
docker update - updates a container's resource limits.

docker start - starts a container so it is running.
docker stop - stops a running container.
docker restart - stops and starts a container.
docker pause - pauses a running container, "freezing" it in place.
docker unpause - will unpause a running container.
docker wait - blocks until running container stops.
docker kill - sends a SIGKILL to a running container.
docker attach - will connect to a running container.

docker images shows all images.
docker import creates an image from a tarball.
docker build creates image from Dockerfile.
docker commit creates image from a container, pausing it temporarily if it is running.
docker rmi removes an image.
docker load loads an image from a tar archive as STDIN, including images and tags (as of 0.7).
docker save saves an image to a tar archive stream to STDOUT with all parent layers, tags & versions (as of 0.7).

docker container stats
docker stats --all

docker ps -a

docker rm image_name delete image
docker rmi $(docker images -q) delete all images

docker container rename nervous_meitner testing
docker exec -it testing /bin/sh

docker ps - show running container
docker inspect - get info from container
docker events - evetns from con
docker port
docker top
docker stats


docker build use a file to create a server ( Dockerfile )
docker pull image (download a image file)
docker ps -l -q -- last run container
docker run -d alpine /bin/sh .c "sleep 20"
docker stop "container"
docker start "container"
docker restart "container"
docker rm `container`
docker cp `container`:/etc/passwd . (copy file to container)




docker build -t wangxian/alpine-mysql .

docker run -it --rm -v $(pwd):/app -p 3306:3306 wangxian/alpine-mysql
(docker MariaDB 10.1.19)
mysql -u root -p -h 172.17.0.1 (111111)

# RUN ALPINE DOCKET SERVER
docker run -it --rm -v $(pwd):/app -p 3306:3306 db933b99cf44

docker run -it --name mysql -p 3306:3306 -v $(pwd):/app -e MYSQL_DATABASE=admin -e MYSQL_USER=tony -e MYSQL_PASSWORD=dpa\*12d -e MYSQL_ROOT_PASSWORD=111111 wangxian/alpine-mysql



docker run -it ubuntu

No hay comentarios:

Publicar un comentario