0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Docker setup memo

Last updated at Posted at 2014-12-01

Prepara

1. Git install

2. VirtualBox install

3. Vagrant install

4. ssh client install (Windows only)

  • Gitbash or Cmder or or Putty or TeraTerm ...

Docker setup

1. CoreOS setup (Docker Host)

$ git clone https://github.com/coreos/coreos-vagrant/ coreos-vagrant

$ cd coreos-vagrant

$ vagrant up

2. CoreOS connect

Mac

$ ssh -i ~/.vagrant.d/insecure_private_key core@127.0.0.1 -p 2222

Windows

$ ssh -i %HOMEPATH%\.vagrant.d\insecure_private_key core@127.0.0.1 -p 2222
# CoreOSには最初からDockerがインストールされている。
$ docker -v
Docker version 1.3.2, build 50b8feb

3. Get dockerfile

# centos
$ docker pull centos
# ubuntu
$ docker pull ubuntu

# dockerfileの確認
$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
ubuntu              latest              86ce37374f40        10 hours ago        192.7 MB
centos              latest              ae0c2d0bdc10        3 weeks ago         224 MB

4. Hello world

$ docker run centos /bin/echo hello world1
hello world1

$ docker run centos /bin/echo hello world2
hello world2

$ docker run centos /bin/echo hello world3
hello world3

5. Check container

$ docker ps -a

CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS
          PORTS               NAMES
7586fb682239        centos:latest       "/bin/echo hello wor   24 seconds ago      Exited (0) 24 seconds ago                       high_mcclintock
f242a610ae65        centos:latest       "/bin/echo hello wor   28 seconds ago      Exited (0) 27 seconds ago                       mad_thompson
7775535004ae        centos:latest       "/bin/echo hello wor   41 seconds ago      Exited (0) 40 seconds ago                       compassionate_turing

6. Remove container

$ docker rm `docker ps -a -q`

7. Login container

$ docker run -i -t centos /bin/bash

8. Commit container

$ docker commit <id>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?