https://github.com/javascriptlove/dockerref
This repo has the Docker most valuable commands
https://github.com/javascriptlove/dockerref
Last synced: about 1 year ago
JSON representation
This repo has the Docker most valuable commands
- Host: GitHub
- URL: https://github.com/javascriptlove/dockerref
- Owner: javascriptlove
- Created: 2015-09-22T14:49:28.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-11-25T09:29:53.000Z (over 10 years ago)
- Last Synced: 2025-01-28T12:45:47.863Z (about 1 year ago)
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Docker reference
Display all running containers
```
docker ps
```
Display all created containers
```
docker ps -a
```
Display the docker IP address (useful when a pack is built with docker-compose)
```
boot2docker ip
```
Delete all docker containers
```
docker rm -f $(docker ps -q -a)
```
Delete all docker images
```
docker rmi -f $(docker images -q)
```
Show running containers
```
docker ps
```
Run **myimagename** in a container named **mycontainer** and set the label **com.example.server** value to **server1**
```
docker run --name mycontainer -l com.example.server=server1 myimagename
```
Get image name based on the label value
```
docker ps --format="{{.Image}}" --filter="label=com.example.server=server1"
```
Get container name based on the label value
```
docker ps --format="{{.Names}}" --filter="label=com.example.server=server1"
```
## Change the docker virtual machine size
If you don't have the **~/.boot2docker/profile** file yet,
```
boot2docker config > ~/.boot2docker/profile
```
Then, in the new **~/.boot2docker/profile** file, change the size
```
DiskSize = 50000
```
Then reinstall boot2docker
```
boot2docker poweroff
boot2docker destroy
boot2docker init
boot2docker up
```
## Docker IP Address
```
docker inspect --format='{{.NetworkSettings.IPAddress}}' CONTAINER_NAME
```
## Route to Docker
```
sudo route -n delete 172.17.0.0/16
sudo route -n add 172.17.0.0/16 `boot2docker ip`
```
## SSH access to docker
```
docker exec -it CONTAINER_ID bash
```
## SSH access to boot2docker
```
boot2docker ssh
```
## An error occurred trying to connect: Get https://xx:xx/v1.20/containers/json: x509: certificate is valid for 127.0.0.1, xx, xxx, not xxxx
First, try ```boot2docker upgrade``` because there was a known bug before 1.7.1.
Then, finally, if it doesn't work, disable all certificate checks
```
alias docker="docker --tlsverify=false"
```