FROM python:3.11-slim
# Install kernel gateway and a Python kernel
RUN pip install --no-cache-dir jupyter-kernel-gateway ipykernel
# Create a non-root user (optional but recommended)
RUN useradd -m jupyter
USER jupyter
WORKDIR /home/jupyter
# Expose the gateway port
EXPOSE 8888
# Start Kernel Gateway in HTTP mode
CMD ["jupyter", \
"kernelgateway", \
"--api=kernel_gateway.jupyter_websocket", \
"--KernelGatewayApp.ip=0.0.0.0", \
"--KernelGatewayApp.port=8888", \
"--KernelGatewayApp.allow_origin=*", \
"--KernelGatewayApp.list_kernels=true", \
"--KernelGatewayApp.auth_token="]
using docker to run a small Jupyter kernel gateway, Tried few api as well
POST http://localhost:8888/api/kernels
WS ws://localhost:8888/api/kernels/07efb6a4-27b9-4d3b-8a14-acfb9247eabf/channels
GET http://localhost:8888/api/kernelspecs
POST http://localhost:8888/api/kernels/163496ec-7e91-4ae5-9d9a-0724444a698a/restart
DELETE http://localhost:8888/api/kernels/977f39d2-c2a7-44d0-a2c2-1047de765aeb
These are working as expected but when i tried hitting http://localhost:8888/api/kernels to get the current running kernel i got {"reason": "Forbidden", "message": "Forbidden"}.