docker hub地址

hub地址

mysql

  • 拉取镜像
    docker pull mysql:5.7
    
  • 创建本地挂载目录
    mkdir -p /home/volume/mysql/data /home/volume/mysql/logs /home/volume/mysql/conf
    
  • 在mysql中的cnf文件夹中创建*.cnf文件
    touch my.cnf
    
  • 创建容器
    docker run -p 3306:3306 --name mysqlA -v /home/mysql/conf:/etc/mysql/conf.d -v /home/mysql/logs:/logs -v /home/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=root -d mysql:5.7
    

redis

  • 拉取镜像
    docker pull redis
    
  • 创建容器
    docker run -d -p 6379:6379 --name redisA redis
    

rabbitMQ

  • 拉取镜像
    docker pull rabbitmq
    
  • 创建容器
    docker run -d --name rabbitmqA -p 5672:5672 -p 15672:15672 -p 25672:25672 -p 61613:61613 -p 1883:1883 -v /rabbitmq/data:/var/lib/rabbitmq --hostname rabbitmqA -e RABBITMQ_DEFAULT_VHOST=rabbitmqA  -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=admin rabbitmq
    
  • 开启web控制台
    docker exec -it rabbitmqA bash
    rabbitmq-plugins enable rabbitmq_management
    rabbitmq-plugins enable rabbitmq_federation_management
    rabbitmq-plugins enable rabbitmq_stomp
    

nginx

  • 拉取镜像
    docker pull mysql:latest
    
  • 创建本地挂载目录
    mkdir -p /home/volumes/nginx/html /home/volumes/nginx/conf /home/volumes/nginx/logs  /home/volume/nginx/conf.d
    
  • 在 volumes/nginx/cnf文件夹中创建nginx.cnf文件
    cd  /home/volumes/nginx/cnf
    touch nginx.cnf
    
    在nginx.cnf初始化一下内容
    
    #user  nobody;
    worker_processes  1;
    
    #error_log  logs/error.log;
    #error_log  logs/error.log  notice;
    #error_log  logs/error.log  info;
    
    #pid        logs/nginx.pid;
    
    
    events {
        worker_connections  1024;
    }
    
    
    http {
        include       mime.types;
        default_type  application/octet-stream;
    
        #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
        #                  '$status $body_bytes_sent "$http_referer" '
        #                  '"$http_user_agent" "$http_x_forwarded_for"';
    
        #access_log  logs/access.log  main;
    
        sendfile        on;
        #tcp_nopush     on;
    
        #keepalive_timeout  0;
        keepalive_timeout  65;
    
        #gzip  on;
    
        server {
            listen       80;
            server_name  localhost;
    
            #charset koi8-r;
    
            #access_log  logs/host.access.log  main;
    
            location / {
                root   html;
                index  index.html index.htm;
            }
    
            #error_page  404              /404.html;
    
            # redirect server error pages to the static page /50x.html
            #
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   html;
            }
    
            # proxy the PHP scripts to Apache listening on 127.0.0.1:80
            #
            #location ~ \.php$ {
            #    proxy_pass   http://127.0.0.1;
            #}
    
            # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
            #
            #location ~ \.php$ {
            #    root           html;
            #    fastcgi_pass   127.0.0.1:9000;
            #    fastcgi_index  index.php;
            #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            #    include        fastcgi_params;
            #}
    
            # deny access to .htaccess files, if Apache's document root
            # concurs with nginx's one
            #
            #location ~ /\.ht {
            #    deny  all;
            #}
        }
    
    
        # another virtual host using mix of IP-, name-, and port-based configuration
        #
        #server {
        #    listen       8000;
        #    listen       somename:8080;
        #    server_name  somename  alias  another.alias;
    
        #    location / {
        #        root   html;
        #        index  index.html index.htm;
        #    }
        #}
    
    
        # HTTPS server
        #
        #server {
        #    listen       443 ssl;
        #    server_name  localhost;
    
        #    ssl_certificate      cert.pem;
        #    ssl_certificate_key  cert.key;
    
        #    ssl_session_cache    shared:SSL:1m;
        #    ssl_session_timeout  5m;
    
        #    ssl_ciphers  HIGH:!aNULL:!MD5;
        #    ssl_prefer_server_ciphers  on;
    
        #    location / {
        #        root   html;
        #        index  index.html index.htm;
        #    }
        #}
    
    }
    
    
  • 创建容器
    docker run --name nginxA -p 80:80 -v /home/volume/nginx/html:/usr/share/nginx/html -v /home/volume/nginx/conf/nginx.cnf:/etc/nginx/nginx.conf  -v /home/volume/nginx/logs:/var/log/nginx -v /home/volume/nginx/conf.d:/etc/nginx/conf.d -d --restart=always nginx:latest
    

zipkin

  • 拉取镜像
    docker pull openzipkin/zipkin
  • 创建容器
    docker run -d  -p 9411:9411 --name zipkinA openzipkin/zipkin

未完待续

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐