拉取镜像

docker pull amancevice/superset

查看拉取的镜像ID

[root@bigdata ~]# docker images
REPOSITORY            TAG                              IMAGE ID       CREATED        SIZE
amancevice/superset   latest                           080aab78f603   2 years ago    2.34GB

安装

创建目录

mkdir /opt/superset/ -p

运行Superset容器

docker run -d -p 8088:8088 -v /opt/superset:/home/superset amancevice/superset

查看运行后ID

[root@bigdata ~]# docker ps 
CONTAINER ID   IMAGE                 COMMAND                  CREATED         STATUS                   PORTS                                       NAMES
2aa4a3e53a3a   amancevice/superset   "gunicorn superset.a…"   4 minutes ago   Up 3 minutes (healthy)   0.0.0.0:8088->8088/tcp, :::8088->8088/tcp   pedantic_mclaren

设置用户名密码

docker exec -it 2aa4a3e53a3a flask fab create-admin --app superset

可能报错,原因是本地的Python是2.x版本,执行该命令需要python3.x版本

Username [admin]: docker exec -it 2aa4a3e53a3a flask fab create-admin --app superset
User first name [admin]: 
User last name [user]: avris
Email [admin@fab.org]: 
Password: 
Repeat for confirmation: 
Traceback (most recent call last):
  File "/usr/local/bin/fabmanager", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/console.py", line 422, in cli
    cli_app()
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/console.py", line 137, in create_admin
    auth_type.get(_appbuilder.sm.auth_type, "No Auth method")

解决方法进入容器创建用户名和密码,也可以将python2.x升级到3.x解决该问题

superset@2aa4a3e53a3a:~$ superset fab create-admin
logging was configured successfully
2024-01-03 05:51:26,162:INFO:superset.utils.logging_configurator:logging was configured successfully
2024-01-03 05:51:26,179:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'>
/usr/local/lib/python3.8/site-packages/flask_caching/__init__.py:201: UserWarning: Flask-Caching: CACHE_TYPE is set to null, caching is effectively disabled.
  warnings.warn(
Username [admin]: 
User first name [admin]: 
User last name [user]: avris
Email [admin@fab.org]: 
Password: 
Repeat for confirmation: 
Recognized Database Authentications.
Admin User admin created.

初始化数据库

docker exec -it 2aa4a3e53a3a superset db upgrade

服务初始化

docker exec -it 2aa4a3e53a3a superset init

启动superset服务

docker exec -it 2aa4a3e53a3a flask run --with-threads --reload --debugger

访问服务

http://ip:8088/login/

01-03 23:07