vrijdag 27 september 2019

Docker II

Some Docker commands:

Build a new container:
docker build -t mycontainer .
Start the container
docker run mycontainer
Start the container detached (returning containerID)
docker run --detach mycontainer
Stop container
docker stop mycontainer
Restart container (silent)
docker start mycontainer
Restart container (with console attached)
docker attach mycontainer
Keep data changes made on container
docker commit mycontainer
Execute command on running container

docker exec -it mycontainerID bash remove all containers: docker rm $(docker ps -a -q)

To show only running containers use the given command:
Commit a change made in a running container: docker commit CONTAINER_ID myContainer

docker ps

To show all containers use the given command:

docker ps -a
With environment vars: docker run --env-file ./env.list mycontainer

Geen opmerkingen:

Een reactie posten