34
loading...
This website collects cookies to deliver better user experience
docker run <image-name>
docker run hello-world
docker run <image-name> <default command override>
docker run busybox ls
docker ps
docker ps --all
docker create hello-world
docker start -a 3c8a5bb0fe7153955d1261054e5b4c99f757920f7760fa7c07803cdbee4b36c1
-a
argument watches for any output and prints it on terminaldocker ps --all
docker start -a 1285b5630516
When we re-run / restart a container we cannot replace the default command, it automatically takes the default command on re-run with commond it was created with.
docker system prune
docker logs 73e564097bd5e6689c2bc5687c038dca99ec77d8716f7ff9eeab9434d422bb8d
docker stop <container-id>
docker kill <container-id>
docker exec -it <container-id> <command>
it
flagdocker exec -it <container-id> sh
docker run -it <container-name> sh
Dockerfile
no extension just Dockerfile# Use an existing docker image as base
FROM alpine
# Download and install a dependency
RUN apk add --update redis
# Tell the image what to do when it starts as a container
CMD ["redis-server"]
docker build .
docker build -t <docker-hub -id>/<project>:<version> .
Dont forget the dot at the end.docker run <docker-hub -id>/<project>
docker commit -c 'CMD ["<command>"]' <container id>
COPY <relative local file system> <relative dest>
docker run -p <portno> : <container-port-no> <image-id>
WORKDIR /usr/app
34