docker-compose down #48

Closed
opened 2025-12-29 05:20:59 +01:00 by adam · 7 comments
Owner

Originally created by @seevik2580 on GitHub (Jun 21, 2020).

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). 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
adam closed this issue 2025-12-29 05:20:59 +01: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 :)

@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?

@sickcodes commented on GitHub (Jun 23, 2020): Awesome work! Want to submit a PR?
Author
Owner

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

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

@seevik2580 commented on GitHub (Jun 24, 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
@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

@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

@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

@sickcodes commented on GitHub (Jul 2, 2020): ❤️❤️❤️❤️ I’ll merge when I’m back at the PC @Julioevm ✅
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Docker-OSX-sickcodes#48