Skip to content

Commit

Permalink
Change Portainer port on the host (ddev#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjguru authored Oct 26, 2020
1 parent ed58a73 commit 10257bc
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 30 deletions.
37 changes: 25 additions & 12 deletions docker-compose-services/portainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,39 @@ Portainer is a visual mode for management of containers and networks. Is open-so

## Connection

Ok, by default you can access to the Portainer interface at the next address from your browser:
Ok, by default you can access to the Portainer interface at the next addresses from your browser:

```
https://projectname.ddev.site:9000
https://127.0.0.1:9000
# using http
http://projectname.ddev.site:9001
http://127.0.0.1:9001
# or using https
https://projectname.ddev.site:8001
https://127.0.0.1:8001
```
**Why?** Well, we're setting the mapped ports from Host to Guest just likes this:

```
environment:
HTTP_EXPOSE: "9001:9000"
HTTPS_EXPOSE: "8001:9000"
```

Cause is the annotated port registered in the config.yaml file. If you want to avoid conflicts, just stop your DDEV-Local network, change the value and relaunch the containers.
If you want to avoid conflicts in the host side, just stop your DDEV-Local network, changing the value in the former section and relaunch the containers.

Just do:
Just do:

```
ddev stop
vim docker-compose.portainer.yaml
ports:
- '3434:9000'
:wq!
ddev start
$ ddev stop
$ vim docker-compose.portainer.yaml
environment:
HTTP_EXPOSE: "3401:9000"
HTTPS_EXPOSE: "3501:9000"
:wq!
$ ddev start
```

But remember that Portainer always exposes from port 9000, so use this address as destiny in your mapping.
And remember that Portainer always exposes internally to the ddev network from its port 9000 in the container, so use this address as destiny in your mapping.

**Contributed by [davidjguru](https://gitlab.com/davidjguru)**, [Drupal Developer](https://www.drupal.org/u/davidjguru) and blogger in [The Russian Lullaby](https://www.therussianlullaby.com/).
38 changes: 20 additions & 18 deletions docker-compose-services/portainer/docker-compose.portainer.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
---
version: '3.6'
services:
portainer:
image: portainer/portainer:latest
restart: always
container_name: ddev-${DDEV_SITENAME}-portainer
labels:
com.ddev.site-name: ${DDEV_SITENAME}
com.ddev.approot: $DDEV_APPROOT
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
external_links:
- "ddev-router:${DDEV_HOSTNAME}"
cap_add:
- SYS_ADMIN
ports:
- '9000:9000'
- '8000:8000'
portainer:
image: portainer/portainer:latest
expose:
- "9000"
environment:
- VIRTUAL_HOST=$DDEV_HOSTNAME
- HTTP_EXPOSE=9001:9000
- HTTPS_EXPOSE=8001:9000
restart: "no"
container_name: ddev-${DDEV_SITENAME}-portainer
labels:
com.ddev.site-name: ${DDEV_SITENAME}
com.ddev.approot: $DDEV_APPROOT
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
external_links:
- "ddev-router:${DDEV_HOSTNAME}"
cap_add:
- SYS_ADMIN
volumes:
portainer_data:

networks:
default:
external:
name: ddev_default

0 comments on commit 10257bc

Please sign in to comment.