¡Esta es una revisión vieja del documento!
docker run <image name> command
docker run busybox echo hi there
docker create <image name>
docker start <container id>
docker ps –all
docker ps
docker system prune
docker logs <container 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.LASTID=`docker run -d -p 80:80 svn` docker kill $LASTID
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 image ls docker image --all # o -a, show intermediate images docker image prune # removes the unused docker image inspect # shows info about the image
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