1. 停止虚拟机
virsh destroy instance-000007c4
2. 挂载虚拟机的磁盘文件:
qemu-nbd –c /dev/nbd15 /dsx01/instances/instance-000007c4
kpartx –a /dev/nbd15
mkdir –p /tmp/tmpClone
mount /dev/mapper/nbd15p1 /tmp/tmpClone
3. 生成root用户的密码,这里密码就是root,(虚拟机原密码不是root)
openssl passwd -1 -salt $(< /dev/urandom tr -dc '[:alnum:]' | head -c 32)
4. 将生成的字符串替换/etc/shadow文件中root的用户密码(替换整个第二个分段):
保存并退出。
5. 卸载磁盘文件:
umount /dev/mapper/nbd15p1
kpartx –d /dev/nbd15
qemu-nbd –d /dev/nbd15
6. 打开虚拟机并登陆
virsh start instance-000007c4
ssh root@$ip
分类:虚拟化
docker学习笔记01
1、we can show a list of current containers using the docker ps -a command.
By default, when we run just docker ps, we will only see the running containers.
When we specify the -a flag, the docker ps command will show us all containers,
both stopped and running.
You can also use the docker ps command with the -l flag to show the last
container that was run, whether it is running or stopped.
2、Starting a stopped container
docker start bob_the_container(your container name).
We could also refer to the container by its container ID instead.
docker start aa3f365f0f4e
3、how to daemonized containers:
docker run –name daemon_dave -d ubuntu /bin/sh -c “while ↩
true; do echo hello world; sleep 1; done”
see what happen inside a docker:
docker logs daemon_dave
docker logs -f daemon_dave
docker logs -ft daemon_dave (add timestamps)
4、inspect docker’s process
docker top daemon_dave
docker inspect –format ‘{{ .NetworkSettings.IPAddress }}’
5、delete a container
docker rm 80430f8d0921
delete all containers
docker rm `docker ps -a -q`
ubuntu配置daocloud.io的 docker加速步骤
1、安装 docker
curl -sSL https://get.daocloud.io/docker | sh
vi /etc/sysconfig/docker
修改以下内容
DOCKER_OPTS=”–registry-mirror=http://8f7287be.m.daocloud.io”
2、重启 docker 服务
service docker status
4、pull 一个docker 实例,然后启动
docker pull ubuntu
速度很快哦。