取付ドッカー[流浪+ Virtualboxのによる=> CentOSに】

1.概要

1.我这里使用的电脑是本地的mac系统
2.因为我现在需要弄一台centos的linux服务器,所以我们这里使用vagrant去生成一个centso的linux的系统环境;
3.在vagrant去生成系统环境的过程中,需要提前安装一个VirtualBox

2.vagrantインストール

浮浪者ダウンロード

https://www.vagrantup.com/downloads.html
さまざまなバージョン
ここに画像を挿入説明

マウンティング

ポイントに直接ダウンされた、デフォルトの設定のインストール

インストールが成功したかどうかをテスト

ここに画像を挿入説明
ディスプレイのバージョンは、インストールが正常に完了したことを意味します

浮浪者、一般的に使用されるコマンド

浮浪者のssh

	进入刚才创建的centos7中

浮浪者のステータス

	查看centos7的状态

放浪停止

	停止/关闭centos7

破壊浮浪者

	删除centos7

浮浪者のステータス

查看状态

放浪ヘルプヘルプ

MacBook-Pro:centos7 gaoxinfu$ vagrant help
Usage: vagrant [options] <command> [<args>]

    -v, --version                    Print the version and exit.
    -h, --help                       Print this help.

Common commands:
     box             manages boxes: installation, removal, etc.
     cloud           manages everything related to Vagrant Cloud
     destroy         stops and deletes all traces of the vagrant machine
     global-status   outputs status Vagrant environments for this user
     halt            stops the vagrant machine
     help            shows the help for a subcommand
     init            initializes a new Vagrant environment by creating a Vagrantfile
     login           
     package         packages a running vagrant environment into a box
     plugin          manages plugins: install, uninstall, update, etc.
     port            displays information about guest port mappings
     powershell      connects to machine via powershell remoting
     provision       provisions the vagrant machine
     push            deploys code in this environment to a configured destination
     rdp             connects to machine via RDP
     reload          restarts vagrant machine, loads new Vagrantfile configuration
     resume          resume a suspended vagrant machine
     snapshot        manages snapshots: saving, restoring, etc.
     ssh             connects to machine via SSH
     ssh-config      outputs OpenSSH valid configuration to connect to the machine
     status          outputs status of the vagrant machine
     suspend         suspends the machine
     up              starts and provisions the vagrant environment
     upload          upload to machine via communicator
     validate        validates the Vagrantfile
     version         prints current and latest Vagrant version
     winrm           executes commands on a machine via WinRM
     winrm-config    outputs WinRM configuration to connect to the machine

For help on any individual command run `vagrant COMMAND -h`

Additional subcommands are available, but are either more advanced
or not commonly used. To see all subcommands, run the command
`vagrant list-commands`.

MacBook-Pro:centos7 gaoxinfu$ 

3.VirtualBoxインストール

ダウンロード

https://www.virtualbox.org/wiki/Downloads

関連システムなどのバージョン

インストール

インストールがデフォルトにあり

次のようにインストールが正常に完了したら

ここに画像を挿入説明

4.centosシステムのインストール

初期化浮浪者

MacBook-Pro:docker gaoxinfu$ pwd
/Users/gaoxinfu/docker
MacBook-Pro:docker gaoxinfu$ makdir centos/7
MacBook-Pro:docker gaoxinfu$ ll
total 24
drwxr-xr-x   5 gaoxinfu  staff    160 11  8 15:24 ./
drwxr-xr-x@ 66 gaoxinfu  staff   2112 11 12 13:55 ../
drwxr-xr-x   4 gaoxinfu  staff    128 11  8 15:26 centos7/
MacBook-Pro:docker gaoxinfu$ 
MacBook-Pro:docker gaoxinfu$ cd centos7/
MacBook-Pro:centos7 gaoxinfu$ pwd
/Users/gaoxinfu/docker/centos7
MacBook-Pro:centos7 gaoxinfu$ 

スタート初期化

MacBook-Pro:centos7 gaoxinfu$ vagrant init centos/7

Vagrantfileは、ビンの後、現在のディレクトリ内のファイルを生成します。

MacBook-Pro:centos7 gaoxinfu$ pwd
/Users/gaoxinfu/docker/centos7
MacBook-Pro:centos7 gaoxinfu$ ls
Vagrantfile
MacBook-Pro:centos7 gaoxinfu$ 

画像centos7を初期化することによりベイグラント

centos7のダウンロードVirtualBoxのイメージ

Baiduの

リンクします。https://pan.baidu.com/s/1Cusm2nZ3xI7p6danMFfrDwパスワード:p08y

ここに私たちのvirtualbox.box下の注VirtualBoxのシーンのうち、私たちのガイドです。

ベイグラントでミラーを追加

MacBook-Pro:image gaoxinfu$ pwd
/Users/gaoxinfu/docker/image
MacBook-Pro:image gaoxinfu$ ls
virtualbox.box
MacBook-Pro:image gaoxinfu$ 
MacBook-Pro:centos7 gaoxinfu$ pwd
/Users/gaoxinfu/docker/centos7
MacBook-Pro:centos7 gaoxinfu$ vagrant box add centos/7 /Users/gaoxinfu/docker/centos7/virtualbox.box
MacBook-Pro:image gaoxinfu$ vagrant box list
centos/7 (virtualbox, 0)

5.dockerインストール

5.1。スタート浮浪者[放浪アップ]

MacBook-Pro:centos7 gaoxinfu$ pwd
/Users/gaoxinfu/docker/centos7
MacBook-Pro:centos7 gaoxinfu$ vagrant ssh
VM must be running to open SSH connection. Run `vagrant up`
to start the virtual machine.
MacBook-Pro:centos7 gaoxinfu$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: No guest additions were detected on the base box for this VM! Guest
    default: additions are required for forwarded ports, shared folders, host only
    default: networking, and more. If SSH fails on this machine, please install
    default: the guest additions and repackage the box to continue.
    default: 
    default: This is not an error message; everything may continue to work properly,
    default: in which case you may ignore this message.
==> default: Rsyncing folder: /Users/gaoxinfu/docker/centos7/ => /vagrant
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
MacBook-Pro:centos7 gaoxinfu$ 

5.2。私たちは放浪のコマンドを使用してインストールCentOSに着陸システム

MacBook-Pro:centos7 gaoxinfu$ vagrant ssh
[vagrant@localhost ~]$ 

5.3。のCentOSシステムはドッカーに搭載しました

アンインストールドッカ

[vagrant@localhost ~]$ sudo yum remove docker \
>                   docker-client \
>                   docker-client-latest \
>                   docker-common \
>                   docker-latest \
>                   docker-latest-logrotate \
>                   docker-logrotate \
>                   docker-engine

インストールがドッカーの依存します

[vagrant@localhost ~]$ sudo yum install -y yum-utils \
>     device-mapper-persistent-data \
>     lvm2

指定した内容ドッカー倉庫

[vagrant@localhost ~]$ sudo yum-config-manager \
      --add-repo \
      https://download.docker.com/linux/centos/docker-ce.repo

ここに画像を挿入説明

インストールを開始します

[vagrant@localhost ~]$ sudo yum install -y docker-ce docker-ce-cli containerd.io

ここに画像を挿入説明
このインストールは完了です

5.4。開始

[vagrant@localhost ~]$ sudo systemctl start docker

ここに画像を挿入説明
私たちは次のことに注意を払う、となっている意味を変更するには、Linuxのコマンドラインで\スラッシュの下にここに注意してください。

5.5テストのドッキングウィンドウが正常にインストール

[vagrant@localhost ~]$ sudo docker run hello-world

ここに画像を挿入説明

公開された261元の記事 ウォン称賛37 ビュー20万+

おすすめ

転載: blog.csdn.net/u014636209/article/details/103052261