zoukankan      html  css  js  c++  java
  • Docker 制作mysql镜像

    # 拉取Ubuntu镜像

    docker pull docker.io/ubuntu:14.04.3

    # 运行一个容器

    docker run --name mysql -p 33:3306 -v /mysql:/var/lib/mysql -it docker.io/ubuntu:14.04.3

    -p 映射容器端口3306到本地端口33,-v 映射容器存储/var/lib/mysql到本地/mysql,--name给容器取名,-it进入交互终端。

    # 容器内安装mysql-server

    root@816bee758633:/# apt-get -y install mysql-server

    安装途中会出现

    输入mysql "root"用户的密码。

    # 开启mysql服务

    service mysql start

    # 进入mysql

    root@816bee758633:/# mysql -u root -p123456
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 44
    Server version: 5.5.35-1ubuntu1 (Ubuntu)
    
    Copyright (c) 2000, 2013, 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> 

    # 查看存储映射

    # 查看端口映射

  • 相关阅读:
    数据库(DB)
    PHP课程设计
    版本号设计规则
    设计模式(Java)
    简单的流式布局(移动应用开发)
    laravel工作机制(PHP程序设计)
    接口自动化测试(软件测试)
    Java学习路线
    ES6基础知识
    promise
  • 原文地址:https://www.cnblogs.com/zeppelin/p/5919716.html
Copyright © 2011-2022 走看看