Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Check if docker is running
- service docker.io status
- # Exit container
- ctrl + p + q
- # Docker info and docker version
- docker -v
- docker version
- docker info
- # Add non-root to the docker group (check if it's not added first)
- cat /etc/group
- sudo gpasswd -a username docker
- # Configure Docker to communicate over the network
- # Check programs running on the network & stop docker service
- netstat -tlp
- service docker stop
- # COnfigure docker to run on IP and on UNIX
- docker -H IP_ADDRESS:2375 -H unix:///var/run/docker.sock -d &
- # In another machine, point the deamon to the IP where docker was configured, then reset
- export DOCKER_HOST="tcp://IP_ADDRESS:2375"
- export DOCKER_HOST=
- # Docker running images and were running
- docker ps
- docker ps -a
- # Docker images location files
- /var/lib/docker/<mount>/diff/<image_id>
- # Run ubuntu interactive on the terminal (-it) and run the bash process
- docker run -it ubuntu /bin/bash
- # Run detached
- docker run -d ubuntu /bin/bash -c "ping 8.8.8.8 -c 30"
- # See top processes inside container or inspect the information for the container
- docker top <hash_id>
- docker inspect <hash_id>
- # Pull images or all tags
- docker pull fedora
- docker pull -a fedora
- # Push images to the hub
- docker tag <image_id> user/<name_repo>
- docker push user/<name_repo>
- # See all images (or only for one)
- docker images
- docker images fedora
- # Images are stored at
- /var/lib/docker/<storage_driver>
- # Docker start and move to container
- docker start <id_container>
- docker attach <id_container>
- # Create a new docker image and save and load
- docker commit <hash_id> <new_image>
- docker save -o /tmp/<name_image> <name_image>
- docker load -i /tmp/<name_image>
- # See history
- docker history <container_name>
- # Docker enter container (looking inside)
- docker-enter <image_id>
- # Execute commands inside terminal
- docker exec -it <image_id> /bin/bash
- # Building from a Dockerfile (build)
- Dockerfile (<- file name)
- # Ubuntu based container (inside file)
- FROM ubuntu:17.10
- MAINTAINER email@example.com
- RUN apt-get update
- CMD ["echo","Hello World"]
- # EXPOSE 80
- # ENTRYPOINT ["echo"]
- # ADD
- # VOLUME /data
- # Execute command to build the Dockerfile
- docker build -t helloworld:0.1 .
- # List all containers
- docker ps -aq
- # Stop all running containers
- docker stop $(docker ps -aq)
- # Remove all containers
- docker rm $(docker ps -aq)
- # Remove all images
- docker rmi $(docker images -q)
Add Comment
Please, Sign In to add comment