Portainer Enable SSL

I cannot run this command I getting error, need help

root@Docker:/# $ docker run -d -p 443:9000 -p 8000:8000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v ~/local-certs:/etc/certs -v portainer_data:/data portainer/portainer-ce --ssl --sslcert /etc/certs/docker.crt --sslkey /etc/certs/docker.key
$: command not found

pl remove $ sign, and run .

Removed $ Thanks, but it’s keep restarting, /etc/certs/docker.crt does exits, but it keep reporting not found

 root@Docker:~# docker run -d -p 443:9000 -p 8000:8000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v ~/local-certs:/certs -v portainer_data:/data portainer/portainer-ce --ssl --sslcert /etc/certs/docker.crt --sslkey /etc/certs/docker.key
22187b542ae7e13467bd5b81af0bfa2891e64262f881bfd48acce4c4da8f8131
root@Docker:~# docker ps -a
CONTAINER ID   IMAGE                    COMMAND                  CREATED         STATUS                        PORTS     NAMES
22187b542ae7   portainer/portainer-ce   "/portainer --ssl --…"   7 seconds ago   Restarting (1) 1 second ago             portainer
root@Docker:~# docker ps -a
CONTAINER ID   IMAGE                    COMMAND                  CREATED         STATUS                         PORTS     NAMES
22187b542ae7   portainer/portainer-ce   "/portainer --ssl --…"   8 seconds ago   Restarting (1) 3 seconds ago             portainer
root@Docker:~# docker ps -a
CONTAINER ID   IMAGE                    COMMAND                  CREATED         STATUS                                  PORTS     NAMES
22187b542ae7   portainer/portainer-ce   "/portainer --ssl --…"   9 seconds ago   Restarting (1) Less than a second ago             portainer
root@Docker:~# docker ps -a
CONTAINER ID   IMAGE                    COMMAND                  CREATED          STATUS                        PORTS     NAMES
22187b542ae7   portainer/portainer-ce   "/portainer --ssl --…"   10 seconds ago   Restarting (1) 1 second ago             portainer
root@Docker:~# docker ps -a
CONTAINER ID   IMAGE                    COMMAND                  CREATED          STATUS                         PORTS     NAMES
22187b542ae7   portainer/portainer-ce   "/portainer --ssl --…"   11 seconds ago   Restarting (1) 2 seconds ago             portainer
root@Docker:~# docker stop 22187b542ae7
22187b542ae7
root@Docker:~# docker ps -a
CONTAINER ID   IMAGE                    COMMAND                  CREATED          STATUS                      PORTS     NAMES
22187b542ae7   portainer/portainer-ce   "/portainer --ssl --…"   29 seconds ago   Exited (1) 13 seconds ago             portainer
root@Docker:~# docker start 22187b542ae7
22187b542ae7
root@Docker:~# docker ps -a
CONTAINER ID   IMAGE                    COMMAND                  CREATED          STATUS                                  PORTS     NAMES
22187b542ae7   portainer/portainer-ce   "/portainer --ssl --…"   38 seconds ago   Restarting (1) Less than a second ago             portainer
root@Docker:~# docker attach 22187b542ae7
You cannot attach to a restarting container, wait until it is running
root@Docker:~# docker ps -a
CONTAINER ID   IMAGE                    COMMAND                  CREATED              STATUS                          PORTS     NAMES
22187b542ae7   portainer/portainer-ce   "/portainer --ssl --…"   About a minute ago   Restarting (1) 14 seconds ago             portainer
root@Docker:~# docker ps -a
CONTAINER ID   IMAGE                    COMMAND                  CREATED              STATUS                          PORTS     NAMES
22187b542ae7   portainer/portainer-ce   "/portainer --ssl --…"   About a minute ago   Restarting (1) 15 seconds ago             portainer
root@Docker:~# docker ps -a
CONTAINER ID   IMAGE                    COMMAND                  CREATED              STATUS                          PORTS     NAMES
22187b542ae7   portainer/portainer-ce   "/portainer --ssl --…"   About a minute ago   Restarting (1) 16 seconds ago             portainer
root@Docker:~# docker ps -a
CONTAINER ID   IMAGE                    COMMAND                  CREATED              STATUS                          PORTS     NAMES
22187b542ae7   portainer/portainer-ce   "/portainer --ssl --…"   About a minute ago   Restarting (1) 18 seconds ago             portainer
root@Docker:~#

Error Logs

  {"log":"2020/12/15 07:17:55 server: Reverse tunnelling enabled\n","stream":"stdout","time":"2020-12-15T07:17:55.091690465Z"}
{"log":"2020/12/15 07:17:55 server: Fingerprint 2c:13:10:22:9b:a9:c1:7f:8a:e0:8c:1b:82:d6:ba:d4\n","stream":"stdout","time":"2020-12-15T07:17:55.091773066Z"}
{"log":"2020/12/15 07:17:55 server: Listening on 0.0.0.0:8000...\n","stream":"stdout","time":"2020-12-15T07:17:55.091827942Z"}
{"log":"2020/12/15 07:17:55 Starting Portainer 2.0.0 on :9000\n","stream":"stderr","time":"2020-12-15T07:17:55.092939496Z"}
{"log":"2020/12/15 07:17:55 open /etc/certs/docker.crt: no such file or directory\n","stream":"stderr","time":"2020-12-15T07:17:55.094303824Z"}

Hi
pl create certificate and run, for certificate creation pl follow this link https://documentation.portainer.io/archive/1.23.2/deployment/#secure-portainer-using-ssl

I am trying to use my own certificate, but I am keep getting error.

{"log":"2020/12/15 07:42:09 open /portainer/certs/portainer.crt: not a directory\n","stream":"stderr","time":"2020-12-15T07:42:09.96577334Z"}

Hi
pl make sure directory name passed on below parameter exist and has permission to read
–sslcert /etc/certs/docker.crt --sslkey /etc/certs/docker.key

Can you help with the command I should run for permission, I new to this.

Thanks,

Hi
its chmod command . pl use it after certficates are created n then run docker command to start container