docker run <image name> command
docker run busybox echo hi there
docker create <image name>
docker start <container id>
docker build -f dockerfile.app -t coop . docker run -ti coop python
docker ps –all
docker ps
docker system prune
docker logs <container id>
First, if you just need to see less output, you can have docker only show you the more recent lines:
docker logs --since 30s -f <container_name_or_id>
Or you can put a number of lines to limit:
docker logs --tail 20 -f <container_name_or_id>
docker stop <container id>
docker kill <container id>
docker exec -it <container id> <command>
docker exec -it b65878 redis-cli
Also…
docker exec -it 4e3d15 sh
The idea would be:
Build an image.Run the container. Maybe in daemon mode (-d). It will give you an id.Exec a command, for example sh, into the container id.Ps the id if required.Kill the id.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
docker images docker images debian
docker build .
Doing it setting a proxy:
docker build --build-arg HTTP_PROXY=http://<ip>:<port> .
docker build -t alfred/redis:latest .
docker build -t dockerid/projectname:version <directory>
docker build -t mine/redis:latest . docker run mine/redis:latest
docker tag server:latest myname/server:latest
or
docker tag d583c3ac45fd myname/server:latest
docker image ls docker image --all # o -a, show intermediate images docker image prune docker image prune -a # removes the unused docker image inspect # shows info about the image
docker stats
Info of sizes:
docker system df -v
Info about containers:
docker ps --size
Build a docker-compose.yml: docker-compose build
Run a docker-compose.yml: docker-compose up
Build and run as daemon a docker-compose.yml: docker-compose up -d –build
Run only one service: docker-compose up app
services:
app:
build: .
command: gunicorn OpenAwards.wsgi:application --bind 0.0.0.0:8000
volumes:
- ./:/srv/app/
environment:
- DB_HOST=db
- DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE}
...
Then: env DJANGO_SETTINGS_MODULE=OpenAwards.settings.production docker-coompose up
Imaginemos que tienes un Dockerfile sin CMD definido, podrías construir el contenedor con:
docker build -f Dockerfile.svn -t svn .
Y luego correr dentro de él con:
docker run -ti svn sh