---
title: "docker学习记录"
author: "lalahei"
date: "2016-10-29T13:26:45Z"
tags: []
categories: ["开源软件"]
slug: "docker"
draft: false
lastmod: "2016-11-01T20:46:49Z"
id: 2334110
url: "https://lalahei.iteye.com/blog/2334110"
---

启动容器

docker run -i -t -v /root/software/:/mnt/software/ 25c5298b1a36 /bin/bash

 

-i：表示以“交互模式”运行容器  
\-t：表示容器启动后会进入其命令行  
\-v：表示需要将本地哪个目录挂载到容器中，格式：-v &lt;宿主机目录&gt;:&lt;容器目录&gt;

 

删除所有正在运行的容器

sudo docker rm $(docker ps -a -q)

 

进入容器

docker exec -it test01 bash  # 进入容器也可以用exec命令

 

curl -fsSLO https://get.docker.com/builds/Linux/x86\_64/docker-1.12.3.tgz && tar --strip-components=1 -xvzf docker-1.12.3.tgz -C /usr/local/bin