Skip to content

Instantly share code, notes, and snippets.

@efiku
Last active September 18, 2017 12:14
Show Gist options
  • Save efiku/62ea53e58e700dcb74f7c3f3bc718ed3 to your computer and use it in GitHub Desktop.
Save efiku/62ea53e58e700dcb74f7c3f3bc718ed3 to your computer and use it in GitHub Desktop.

Revisions

  1. efiku revised this gist Sep 18, 2017. 1 changed file with 10 additions and 1 deletion.
    11 changes: 10 additions & 1 deletion vps.md
    Original file line number Diff line number Diff line change
    @@ -46,4 +46,13 @@ docker exec -it $C_N bash
    ```

    ### Kasowanie apache pid

    ```sh
    #!/bin/sh
    docker stop $(docker ps -a -q);
    for i in `find /var/lib/docker -iname apache2.pid && find /var/lib/docker -iname php5-fpm.pid`; do
    rm $i;
    done;
    docker restart $(docker ps -a -q);
    #for i in `docker ps -a -q | grep -v X`; do docker exec -u 0 -i -t $i service php5-fpm restart; done;

    ```
  2. efiku revised this gist Sep 18, 2017. 1 changed file with 11 additions and 7 deletions.
    18 changes: 11 additions & 7 deletions vps.md
    Original file line number Diff line number Diff line change
    @@ -5,25 +5,25 @@ Proste komendy o ktorych zapominam..
    ```sh
    C_N='vpstest'
    C_P='6909'
    C_V='/var/www/:/var/www/'
    C_VV='-v /home/efik/vps-data/apache2/sites/'
    docker run --name $C_N -d -p $C_P:80 -v $C_V $C_VV cloudposse/apache-php-fpm
    C_VOLUME_DATA="/var/www/separated-containers/${C_N}/:/var/www/"
    C_VOLUME_HOSTS="-v /var/vps/separated-app/${C_N}/:/etc/apache2/sites-enabled/"
    docker run --name $C_N -d -p $C_P:80 -v $C_VOLUME_DATA $C_VOLUME_HOSTS cloudposse/apache-php-fpm
    ```

    **Zapisywanie stanu obecnego kontenera**
    ```sh
    C_N='name'
    C_N='zdrowie.brat.pl'
    docker stop $C_N
    # można bez stopa, ale zapisując w locie zapisujemy pid apacha
    docker commit $_N backup-$_N
    docker commit $C_N backup-$C_N
    docker start $C_N
    ```

    **Backup do pliku**
    ```sh
    C_N='name'
    C_D='/mnt/'
    docker save bak-$C_N > $_D$C_N.tar
    docker save backup-$C_N > $_D$C_N.tar
    ```

    **Restore backup**
    @@ -32,7 +32,8 @@ C_N='name'
    C_D='/mnt/'
    docker load -i $C_D$C_N.tar
    ```
    Po przywroceniu trzeba zrobic docker run -p .. -n... ale $C_N
    Po przywroceniu trzeba zrobic
    docker run --name $C_N -d -p $C_P:80 -v $C_VOLUME_DATA $C_VOLUME_HOSTS cloudposse/apache-php-fpm
    obrazy stare pokasowac

    //TODO: Pomyśleć nad podmontowaniem apachowych stron jak w przykladzie.
    @@ -43,3 +44,6 @@ obrazy stare pokasowac
    C_N='name'
    docker exec -it $C_N bash
    ```

    ### Kasowanie apache pid

  3. efiku revised this gist Feb 21, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions vps.md
    Original file line number Diff line number Diff line change
    @@ -14,6 +14,7 @@ docker run --name $C_N -d -p $C_P:80 -v $C_V $C_VV cloudposse/apache-php-fpm
    ```sh
    C_N='name'
    docker stop $C_N
    # można bez stopa, ale zapisując w locie zapisujemy pid apacha
    docker commit $_N backup-$_N
    docker start $C_N
    ```
  4. efiku revised this gist Feb 21, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions vps.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    Proste komendy o ktorych zapominam..
    ### KOMENDY DOCKER

    * Tworzenie nowego kontenera *
    **Tworzenie nowego kontenera**
    ```sh
    C_N='vpstest'
    C_P='6909'
    @@ -18,7 +18,7 @@ docker commit $_N backup-$_N
    docker start $C_N
    ```

    ** Backup do pliku ***
    **Backup do pliku**
    ```sh
    C_N='name'
    C_D='/mnt/'
  5. efiku revised this gist Feb 21, 2017. 1 changed file with 14 additions and 4 deletions.
    18 changes: 14 additions & 4 deletions vps.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    Proste komendy o ktorych zapominam..
    ### test
    ### KOMENDY DOCKER

    * Tworzenie nowego kontenera *
    ```sh
    @@ -10,25 +10,35 @@ C_VV='-v /home/efik/vps-data/apache2/sites/'
    docker run --name $C_N -d -p $C_P:80 -v $C_V $C_VV cloudposse/apache-php-fpm
    ```

    * Zapisywanie stanu obecnego kontenera
    **Zapisywanie stanu obecnego kontenera**
    ```sh
    C_N='name'
    docker stop $C_N
    docker commit $_N backup-$_N
    docker start $C_N
    ```

    * Backup do pliku *
    ** Backup do pliku ***
    ```sh
    C_N='name'
    C_D='/mnt/'
    docker save bak-$C_N > $_D$C_N.tar
    ```

    *Restore backup*
    **Restore backup**
    ```sh
    C_N='name'
    C_D='/mnt/'
    docker load -i $C_D$C_N.tar
    ```
    Po przywroceniu trzeba zrobic docker run -p .. -n... ale $C_N
    obrazy stare pokasowac

    //TODO: Pomyśleć nad podmontowaniem apachowych stron jak w przykladzie.


    ### Wchodzenie do kontenera
    ```sh
    C_N='name'
    docker exec -it $C_N bash
    ```
  6. efiku revised this gist Feb 21, 2017. 1 changed file with 34 additions and 2 deletions.
    36 changes: 34 additions & 2 deletions vps.md
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,34 @@
    Test
    # test
    Proste komendy o ktorych zapominam..
    ### test

    * Tworzenie nowego kontenera *
    ```sh
    C_N='vpstest'
    C_P='6909'
    C_V='/var/www/:/var/www/'
    C_VV='-v /home/efik/vps-data/apache2/sites/'
    docker run --name $C_N -d -p $C_P:80 -v $C_V $C_VV cloudposse/apache-php-fpm
    ```

    * Zapisywanie stanu obecnego kontenera
    ```sh
    C_N='name'
    docker stop $C_N
    docker commit $_N backup-$_N
    docker start $C_N
    ```

    * Backup do pliku *
    ```sh
    C_N='name'
    C_D='/mnt/'
    docker save bak-$C_N > $_D$C_N.tar
    ```

    *Restore backup*
    ```sh
    C_N='name'
    C_D='/mnt/'
    docker load -i $C_D$C_N.tar
    ```
    Po przywroceniu trzeba zrobic docker run -p .. -n... ale $C_N
  7. efiku created this gist Feb 21, 2017.
    2 changes: 2 additions & 0 deletions vps.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    Test
    # test