{"id":662,"date":"2024-07-05T17:15:58","date_gmt":"2024-07-05T09:15:58","guid":{"rendered":"https:\/\/china-abc.leohe.net.cn\/?p=662"},"modified":"2024-07-05T17:16:09","modified_gmt":"2024-07-05T09:16:09","slug":"docker-gogs-git-%e6%9c%8d%e5%8a%a1","status":"publish","type":"post","link":"https:\/\/china-abc.leohe.net.cn\/?p=662","title":{"rendered":"docker gogs git \u670d\u52a1"},"content":{"rendered":"<div>\n<div>#\u521b\u5efa\u7f51\u7edc<\/div>\n<div>docker network create backend<\/div>\n<div>#\u62c9\u53d6mysql<\/div>\n<div>docker pull mysql:8.0.20<\/div>\n<div>mkdir -p \/docker\/mysql8.0.20\/etc\/mysql\/conf.d<\/div>\n<div>mkdir \/docker\/mysql8.0.20\/logs<\/div>\n<div>mkdir \/docker\/mysql8.0.20\/data<\/div>\n<div>mkdir \/docker\/mysql8.0.20\/mysql-files<\/div>\n<div>vim \/docker\/mysql8.0.20\/etc\/mysql\/conf.d\/my.cnf<\/div>\n<div>[mysqld]<\/div>\n<div>user=mysql<\/div>\n<div>character-set-server=utf8<\/div>\n<div>default_authentication_plugin=mysql_native_password<\/div>\n<div>secure_file_priv=\/var\/lib\/mysql<\/div>\n<div>expire_logs_days=7<\/div>\n<div>sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION<\/div>\n<div>max_connections=1000<\/div>\n<div>secure-file-priv= NULL<\/div>\n<div>[client]<\/div>\n<div>default-character-set=utf8<\/div>\n<div>[mysql]<\/div>\n<div>#\u542f\u52a8mysql\u5bb9\u5668<\/div>\n<div>docker run \\<\/div>\n<div>-p 3307:3306 \\<\/div>\n<div>--name mysql8 \\<\/div>\n<div>--net=backend \\<\/div>\n<div>--privileged=true \\<\/div>\n<div>--restart on-failure:3 \\<\/div>\n<div>-v \/docker\/mysql8.0.20\/etc\/mysql:\/etc\/mysql \\<\/div>\n<div>-v \/docker\/mysql8.0.20\/logs:\/logs \\<\/div>\n<div>-v \/docker\/mysql8.0.20\/data:\/var\/lib\/mysql \\<\/div>\n<div>-v \/docker\/mysql8.0.20\/mysql-files:\/var\/lib\/mysql-files \\<\/div>\n<div>-v \/etc\/localtime:\/etc\/localtime \\<\/div>\n<div>-e MYSQL_ROOT_PASSWORD=\"123456\" \\<\/div>\n<div>-d mysql<\/div>\n<div># \u8bf4\u660e<\/div>\n<div>-p \u7aef\u53e3\u6620\u5c04 \u3010\u8fd9\u91cc\u6709\u4e2a\u7279\u6b8a\u7684\u5730\u65b9\u662f\u628a3306\u6620\u5c04\u7ed9\u4e863307\u3001\u540e\u7eed\u94fe\u63a5\u6570\u636e\u5e93\u7684\u65f6\u5019\u75283307\u94fe\u63a5\u4e0d\u75283306\u3011<\/div>\n<div>--name mysql8 \u00a0\u540d\u79f0\u662fmysql8<\/div>\n<div>--privileged=true container\u5185\u7684root\u62e5\u6709\u771f\u6b63\u7684root\u6743\u9650\u3002<\/div>\n<div>--restart on-failure:3 \u5728\u5bb9\u5668\u975e\u6b63\u5e38\u9000\u51fa\u65f6\u91cd\u542f\u5bb9\u5668\uff0c\u5e76\u4e14\u6307\u5b9a\u91cd\u542f\u6b21\u6570\u3002n \u4e3a\u6b63\u6574\u6570\u3002\u5982\u679c\u4e0d\u6307\u5b9a\u6b21\u6570\uff0c\u5219\u4f1a\u4e00\u76f4\u91cd\u542f\u3002<\/div>\n<div>-v \/docker\/mysql8.0.20\/etc\/mysql:\/etc\/mysql \\ \u6302\u8f7d\u914d\u7f6e\u6587\u4ef6\u3010\u8def\u5f84\u662f\u4e0a\u9762\u521b\u5efa\u7684\u6302\u8f7d\u8def\u5f84\u3011<\/div>\n<div>-v \/docker\/mysql8.0.20\/logs:\/logs \\ \u00a0\u6302\u8f7d\u65e5\u5fd7\u3010\u8def\u5f84\u662f\u4e0a\u9762\u521b\u5efa\u7684\u6302\u8f7d\u8def\u5f84\u3011<\/div>\n<div>-v \/docker\/mysql8.0.20\/data:\/var\/lib\/mysql \\ \u6302\u8f7d\u6570\u636e\u6587\u4ef6 \u6301\u4e45\u5316\u5230\u4e3b\u673a\u3010\u8def\u5f84\u662f\u4e0a\u9762\u521b\u5efa\u7684\u6302\u8f7d\u8def\u5f84\u3011<\/div>\n<div>-v \/etc\/localtime:\/etc\/localtime \u5bb9\u5668\u65f6\u95f4\u4e0e\u5bbf\u4e3b\u673a\u540c\u6b65<\/div>\n<div>-e MYSQL_ROOT_PASSWORD=123456 \u8bbe\u7f6eroot\u5bc6\u7801<\/div>\n<div>-d mysql:8.0.20 \u540e\u53f0\u542f\u52a8,mysql<\/div>\n<div>5\u3001\u8fdb\u5165mysql\u5bb9\u5668\u521b\u5efa\u7528\u6237<\/div>\n<div>docker exec -it mysql8 bash<\/div>\n<div>6\u3001\u5728\u5bb9\u5668\u5185\u767b\u5f55mysql\uff0c\u5982\u679c\u51fa\u73b0\u5f02\u5e38\uff1a\uff08\u521d\u59cb\u5bc6\u7801\u4e0d\u6210\u529f\uff0c\u5bc6\u7801\u9ed8\u8ba4\u4e3a\u7a7a\uff0c\u76f4\u63a5Enter\uff09\u4fdd\u8bc1\u8fdb\u5165\u5230mysql\u547d\u4ee4\u884c\u3002<\/div>\n<div>mysql -u root -p<\/div>\n<div>7\u3001\u521b\u5efa\u8fdc\u7a0b\u8fde\u63a5\u7528\u6237<\/div>\n<div>create user 'root'@'%' identified by '123456' PASSWORD EXPIRE NEVER;<\/div>\n<div>grant all privileges on *.* to 'root'@'%';<\/div>\n<div>flush privileges;<\/div>\n<div>#\u542f\u52a8gogs\u5bb9\u5668<\/div>\n<div>docker run --name=gogs --net=backend -p 10022:22 -p 10880:3000 -v \/var\/gogs:\/data gogs\/gogs<\/div>\n<div>#\u5b89\u88c5\u914d\u7f6egogs<\/div>\n<div>\u8f93\u5165\u5730\u5740\uff1ahttp:\/\/xxxx:10880\/install<\/div>\n<div>\u6570\u636e\u5e93\u5730\u5740\u53ef\u4ee5\u5199mysql8:3306<\/div>\n<div>#\u8fdb\u5165\u7cfb\u7edf<\/div>\n<div>\u5b89\u88c5\u6210\u529f\u540e\u8f93\u5165\uff1ahttp:\/\/xxxx:10880\/\u8fdb\u5165\u540e\u53f0 \u521b\u5efa\u7528\u6237\u548c\u9879\u76ee<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>#\u521b\u5efa\u7f51\u7edc docker network create backend #\u62c9\u53d6mysql docker pul [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[13,10,25],"tags":[],"_links":{"self":[{"href":"https:\/\/china-abc.leohe.net.cn\/index.php?rest_route=\/wp\/v2\/posts\/662"}],"collection":[{"href":"https:\/\/china-abc.leohe.net.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/china-abc.leohe.net.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/china-abc.leohe.net.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/china-abc.leohe.net.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=662"}],"version-history":[{"count":2,"href":"https:\/\/china-abc.leohe.net.cn\/index.php?rest_route=\/wp\/v2\/posts\/662\/revisions"}],"predecessor-version":[{"id":664,"href":"https:\/\/china-abc.leohe.net.cn\/index.php?rest_route=\/wp\/v2\/posts\/662\/revisions\/664"}],"wp:attachment":[{"href":"https:\/\/china-abc.leohe.net.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=662"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/china-abc.leohe.net.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=662"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/china-abc.leohe.net.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=662"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}