# Gitea docker advice

**URL:** <https://forum.gitea.com/t/gitea-docker-advice/1220>\
**Category:** Install/Maintain/Configure\
**Created:** [June 4, 2019, 8:50am UTC](https://forum.gitea.com/t/gitea-docker-advice/1220 "2019-06-04T08:50:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jernej](https://avatars.discourse-cdn.com/v4/letter/j/838e76/32.png) [@jernej](https://forum.gitea.com/u/jernej)\
**Post date:** [June 4, 2019, 8:50am UTC](https://forum.gitea.com/t/gitea-docker-advice/1220/1 "2019-06-04T08:50:51Z")

</div>

Hello, I am quite new to Gitea and Docker and I would need an advice.

I installed Gitea on Docker on my local PC and everything was working fine I accessed it trough local ip and port 3000.  
After four days Gitea was not reachable from browser - the error was ERR\_CONNECTION\_REFUSED.

I looked at the containers in docker and they were up and running and also the logs of docker compose were same as always. The Resource monitor in Windows did not list the port 3000 to be in use.

After that I restarted Docker and did `docker-compose down` followed by `docker-compose up -d` . Now I can reach Gitea through browser again and also the Resource monitor lists port 3000 to be in use. But now Gitea has lost all its previous content and I cannot log in with my user account, but it is not like clean install since it does not ask me to enter the Settings for Gitea as it did when it was first installed.

So, I would be glad if someone could give me some advice on this topic.  
Why was it impossible to reach Gitea after days of installing through browser ?  
Does restarting docker and doing docker compose down / up erase all the content ?  
What should I avoid in the future tho not loose content on Gitea (in terms of performing actions regarding docker) ?

---

<div class="post-metadata">

**Author:** ![techknowlogick](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/techknowlogick/32/4706_2.png) [@techknowlogick](https://forum.gitea.com/u/techknowlogick)\
**Post date:** [June 6, 2019, 2:18am UTC](https://forum.gitea.com/t/gitea-docker-advice/1220/2 "2019-06-06T02:18:51Z")

</div>

It sounds like you may not be using docker volumes to persist data. This is something you should be doing for any software you host in docker, not just gitea, because otherwise if a container is deleted or recreated (docker-compose up -d can do this) your data will be deleted.

---

<div class="post-metadata">

**Author:** ![jernej](https://avatars.discourse-cdn.com/v4/letter/j/838e76/32.png) [@jernej](https://forum.gitea.com/u/jernej)\
**Post date:** [June 7, 2019, 5:54am UTC](https://forum.gitea.com/t/gitea-docker-advice/1220/3 "2019-06-07T05:54:12Z")

</div>

This is my docker-compose.yml, Which is mostly from Gitea’s website, am I doing anything wrong?

```
version: "2"

networks:
  gitea:
    external: false

volumes:
  gitea:
    driver: local
    
services:
  server:
    image: gitea/gitea:latest
    environment:
      - USER_UID=1000
      - USER_GID=1000
      - DB_TYPE=mysql
      - DB_HOST=db:3306
      - DB_NAME=gitea
      - DB_USER=gitea
      - DB_PASSWD=gitea
    restart: always
    networks:
      - gitea
    volumes:
      #- ./gitea:/data
       - gitea:/data
    ports:
       - "3000:3000"
       - "222:22"
    depends_on:
      - db

  db:
    image: mysql:5.7
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=gitea
      - MYSQL_USER=gitea
      - MYSQL_PASSWORD=gitea
      - MYSQL_DATABASE=gitea
    networks:
      - gitea
    volumes:
      - ./mysql:/var/lib/mysql
```
