➜ ~ docker search ubuntu
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
ubuntu Ubuntu is a Debian-based Linux operating s... 6509 [OK]
dorowu/ubuntu-desktop-lxde-vnc Ubuntu with openssh-server and NoVNC 128 [OK]
rastasheep/ubuntu-sshd Dockerized SSH service, built on top of of... 97 [OK]
ansible/ubuntu14.04-ansible Ubuntu 14.04 LTS with ansible 86 [OK]
ubuntu-upstart Upstart is an event-based replacement for ... 77 [OK]
➜ ~ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu latest ccc7a11d65b1 3 weeks ago 120MB
mysql/mysql-server latest 3157d7f55f8d 5 weeks ago 241MB
registry.cn-hangzhou.aliyuncs.com/haomo/mdexam zf e00964020355 2 months ago 1.64GB
busybox latest c30178c5239f 2 months ago 1.11MB
juu latest 452596e4f289 2 months ago 118MB
yd/mysql latest 4e84d647f316 3 months ago 586MB
nginx latest 958a7ae9e569 3 months ago 109MB
ubuntu \<\none\>\ ebcd9d4fca80 3 months ago 118MB
mysql
docker run -i -t ubuntu /bin/bash
docker run -it --name mdexam --hostname mdexam -d -p - /Users/liuranran/webwork/skilleee:/opt/work \[路径\] /bin/bash
➜ ~ docker run -i -t ubuntu /bin/bash
root@c6d35db61f33:/# exit
docker ps
➜ ~ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
docker ps -a
➜ ~ docker ps -a
查看所有容器
➜ ~ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3b7409112eb8 ubuntu "/bin/bash" 5 minutes ago Exited (0) 5 minutes ago sharp_williams
docker start c6d35db61f33
➜ ~ docker start c6d35db61f33
c6d35db61f33
➜ ~ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c6d35db61f33 ubuntu "/bin/bash" 7 minutes ago Up 4 seconds silly_aryabhata
docker stop c6d35db61f33
➜ ~ docker stop c6d35db61f33
c6d35db61f33
➜ ~ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
➜ ~
docker start c6d35db61f33
➜ ~ docker start c6d35db61f33
c6d35db61f33
➜ ~ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c6d35db61f33 ubuntu "/bin/bash" 14 minutes ago Up 9 seconds silly_aryabhata
➜ ~ docker exec -i -t c6d35db61f33 /bin/bash
root@c6d35db61f33:/#
docker run -i -t --name testDocker ubuntu /bin/bash
➜ ~ docker run -i -t --name testDocker ubuntu /bin/bash
root@31fd4713f7da:/#
➜ ~ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
31fd4713f7da ubuntu "/bin/bash" 31 seconds ago Exited (0) 14 seconds ago testDocker
docker run--name testDocker -d ubuntu /bin/bash
➜ ~ docker run--name testDocker -d ubuntu /bin/bash
2b6be9c242276b3969d6b8e36f5d07337f770bfe6c64a43fb51054824e995c67
➜ ~ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2b6be9c24227 ubuntu "/bin/bash" 44 seconds ago Up 43 seconds
docker attach 2b6be9c24227
➜ ~ docker attach 2b6be9c24227
root@2b6be9c24227:/#
root@2b6be9c24227:/# exit
exit
➜ ~
➜ ~ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
➜ ~
docker logs 2b6be9c24227
docker top testDocker
➜ ~ docker top testDocker
PID USER TIME COMMAND
3162 root 0:00 /bin/bash
➜ ~
docker top testDocker
➜ ~ docker top testDocker
PID USER TIME COMMAND
3162 root 0:00 /bin/bash
➜ ~
docker run --restart=on-failure:5 --name testR1 -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done"
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
➜ ~ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
➜ ~ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql/mysql-server latest 1fdf3806e715 26 hours ago 309MB
wordpress latest 9414c91da9a8 6 days ago 408MB
mysql latest 7bbe2074ef0a 6 days ago 484MB
➜ ~ docker run --name mysql3306-TY -p 3306:3306 -e "MYSQL_ROOT_PASSWORD=root" -d mysql
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a1e5380e57b0 mysql "docker-entrypoint.s…" 2 hours ago Up 2 hours 0.0.0.0:3306->3306/tcp mysql3306-TY
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.21 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> grant all privileges on *.* to 'root'@'%'identified by 'root' with grant option;