[GH-ISSUE #54] docker-compose down #47

Closed
opened 2026-02-27 22:07:38 +03:00 by kerem · 7 comments
Owner

Originally created by @seevik2580 on GitHub (Jun 21, 2020).
Original GitHub issue: https://github.com/sickcodes/Docker-OSX/issues/54

hi, i installed mac with docker-compose.yml:

version: '3.1'

services:
  osx:
    container_name: "docker-osx"
    build:
      context: .
      args:
        - SIZE=200G
        - VERSION=10.15.5
    image: sickcodes/docker-osx
    privileged: true
    environment:
      - DISPLAY=${DISPLAY:-:0.0}
      - RAM=8
      - SMP=4
      - CORES=4
    network_mode: "host"
    cap_add:
      - ALL
    volumes:
      - ./tmp/.X11-unix:/tmp/.X11-unix
      - /dev:/dev
      - /lib/modules:/lib/modules

after successful install, when i made some changes inside docker-compose.yml i need to use docker-compose down && docker-compose up to take effect, but it will wipe all my data, and i have to install mac again. can you help me how to preserve volume with data ?

thanks <3

Originally created by @seevik2580 on GitHub (Jun 21, 2020). Original GitHub issue: https://github.com/sickcodes/Docker-OSX/issues/54 hi, i installed mac with `docker-compose.yml`: ``` version: '3.1' services: osx: container_name: "docker-osx" build: context: . args: - SIZE=200G - VERSION=10.15.5 image: sickcodes/docker-osx privileged: true environment: - DISPLAY=${DISPLAY:-:0.0} - RAM=8 - SMP=4 - CORES=4 network_mode: "host" cap_add: - ALL volumes: - ./tmp/.X11-unix:/tmp/.X11-unix - /dev:/dev - /lib/modules:/lib/modules ``` after successful install, when i made some changes inside `docker-compose.yml` i need to use `docker-compose down && docker-compose up` to take effect, but it will wipe all my data, and i have to install mac again. can you help me how to preserve volume with data ? thanks <3
kerem closed this issue 2026-02-27 22:07:38 +03:00
Author
Owner

@seevik2580 commented on GitHub (Jun 22, 2020):

i think i figured out with creating new volume docker volume create docker-osx_data
then make some changes inside docker-compose.yml

version: '3.1'

services:
  osx:
    container_name: docker-osx
    build:
      context: .
      args:
        - SIZE=200G
        - VERSION=10.15.5
    image: sickcodes/docker-osx
    privileged: true
    environment:
      - DISPLAY=${DISPLAY:-:0.0}
      - RAM=8
      - SMP=4
      - CORES=4
    network_mode: "host"
    ports:.
      - "50922:10022"
    cap_add:
      - ALL
    volumes:
      - /tmp/.X11-unix:/tmp/.X11-unix
      - /dev:/dev
      - /lib/modules:/lib/modules
      - docker-osx_data:/home

volumes:
  docker-osx_data:
    external: true

and now i can safely use docker-compose down :)

<!-- gh-comment-id:647217097 --> @seevik2580 commented on GitHub (Jun 22, 2020): i think i figured out with creating new volume `docker volume create docker-osx_data` then make some changes inside `docker-compose.yml` ``` version: '3.1' services: osx: container_name: docker-osx build: context: . args: - SIZE=200G - VERSION=10.15.5 image: sickcodes/docker-osx privileged: true environment: - DISPLAY=${DISPLAY:-:0.0} - RAM=8 - SMP=4 - CORES=4 network_mode: "host" ports:. - "50922:10022" cap_add: - ALL volumes: - /tmp/.X11-unix:/tmp/.X11-unix - /dev:/dev - /lib/modules:/lib/modules - docker-osx_data:/home volumes: docker-osx_data: external: true ``` and now i can safely use `docker-compose down` :)
Author
Owner

@sickcodes commented on GitHub (Jun 23, 2020):

Awesome work! Want to submit a PR?

<!-- gh-comment-id:648080982 --> @sickcodes commented on GitHub (Jun 23, 2020): Awesome work! Want to submit a PR?
Author
Owner

@seevik2580 commented on GitHub (Jun 23, 2020):

i don't know how to do it unfortunately, i have just a little experience with git.
feel free to make yours.

<!-- gh-comment-id:648481758 --> @seevik2580 commented on GitHub (Jun 23, 2020): i don't know how to do it unfortunately, i have just a little experience with git. feel free to make yours.
Author
Owner

@seevik2580 commented on GitHub (Jun 24, 2020):

here is the template, i made some changes, removing external: true replacing with custom name for docker-compose to auto create volume if not exists yet. because when external: true is present, docker-compose cant create volume, and you have to create it manualy with docker volume create command and when name: is not present, docker-compose create volume with prefix_ of service name so need to use version 3.4 instead of 3.1 because custom names for volumes was added in 3.4

version: '3.4'

services:
  osx:
    container_name: docker-osx
    build:
      context: .
      args:
        - SIZE=200G
        - VERSION=10.15.5
    image: sickcodes/docker-osx
    privileged: true
    environment:
      - DISPLAY=${DISPLAY:-:0.0}
    network_mode: "host"
    cap_add:
      - ALL
    volumes:
      - /tmp/.X11-unix:/tmp/.X11-unix
      - /dev:/dev
      - /lib/modules:/lib/modules
      - docker-osx_data:/home

volumes:
  docker-osx_data:
    name: docker-osx_data
<!-- gh-comment-id:648489864 --> @seevik2580 commented on GitHub (Jun 24, 2020): here is the template, i made some changes, removing `external: true` replacing with custom `name` for docker-compose to auto create volume if not exists yet. because when `external: true` is present, docker-compose cant create volume, and you have to create it manualy with `docker volume create` command and when `name:` is not present, docker-compose create volume with prefix_ of service name so need to use version 3.4 instead of 3.1 because custom names for volumes was added in 3.4 ``` version: '3.4' services: osx: container_name: docker-osx build: context: . args: - SIZE=200G - VERSION=10.15.5 image: sickcodes/docker-osx privileged: true environment: - DISPLAY=${DISPLAY:-:0.0} network_mode: "host" cap_add: - ALL volumes: - /tmp/.X11-unix:/tmp/.X11-unix - /dev:/dev - /lib/modules:/lib/modules - docker-osx_data:/home volumes: docker-osx_data: name: docker-osx_data ```
Author
Owner

@Julioevm commented on GitHub (Jul 2, 2020):

I've made the PR:
https://github.com/sickcodes/Docker-OSX/pull/57

<!-- gh-comment-id:653045095 --> @Julioevm commented on GitHub (Jul 2, 2020): I've made the PR: https://github.com/sickcodes/Docker-OSX/pull/57
Author
Owner

@seevik2580 commented on GitHub (Jul 2, 2020):

I've made the PR:
#57

thank you <3 i need to learn how to do it in future

<!-- gh-comment-id:653047683 --> @seevik2580 commented on GitHub (Jul 2, 2020): > I've made the PR: > #57 thank you <3 i need to learn how to do it in future
Author
Owner

@sickcodes commented on GitHub (Jul 2, 2020):

❤️❤️❤️❤️ I’ll merge when I’m back at the PC @Julioevm

<!-- gh-comment-id:653056022 --> @sickcodes commented on GitHub (Jul 2, 2020): ❤️❤️❤️❤️ I’ll merge when I’m back at the PC @Julioevm ✅
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Docker-OSX#47
No description provided.