• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

docker-compose

Jekyll on Docker Container

August 30, 2022

Here’s how to run Jekyll in a Docker container.

mkdir blog
cd blog
docker run -v $(pwd):/site bretfisher/jekyll new .
docker run -p 4000:4000 -v $(pwd):/site bretfisher/jekyll-serve

mkdir blog cd blog docker run -v $(pwd):/site bretfisher/jekyll new . docker run -p 4000:4000 -v $(pwd):/site bretfisher/jekyll-serve

Another option is to use docker compose. Create a docker-compose.yml file.

version: 3.5
services:
  jekyll:
    image: bretfisher/jekyll-serve
    volumes:
      - .:/site
    ports:
      - '4000:4000'

version: 3.5 services: jekyll: image: bretfisher/jekyll-serve volumes: - .:/site ports: - '4000:4000'

Run Jekyll.

cd blog
docker-compose up -d

cd blog docker-compose up -d

Stop Jekyll.

cd blog
docker-compose down

cd blog docker-compose down

Filed Under: Linux Tagged With: container, docker, docker-compose, down, jekyll, up

Rebuild Docker containers

December 12, 2021

How to rebuild your application from scratch using Docker.

#!/bin/bash
docker-compose down -v
docker rmi $(docker images -a -q)
docker-compose up -d
docker-compose restart -t 10

#!/bin/bash docker-compose down -v docker rmi $(docker images -a -q) docker-compose up -d docker-compose restart -t 10

Steps

  • Purge the containers.
  • Delete docker images.
  • Reinitiate docker.
  • Restart docker.

Filed Under: Cloud, Linux Tagged With: application, containers, docker, docker-compose, down, rebuild, remove, restart, up

Install Docker on Amazon Linux 2

December 11, 2021

Steps how to install Docker and Docker Compose on Amazon Linux 2.

Install Docker

$ sudo amazon-linux-extras install docker
$ sudo service docker start
$ sudo usermod -a -G docker ec2-user

$ sudo amazon-linux-extras install docker $ sudo service docker start $ sudo usermod -a -G docker ec2-user

Start at boot.

$ sudo chkconfig docker on

$ sudo chkconfig docker on

Install git (optional).

$ sudo yum install -y git

$ sudo yum install -y git

Install Docker Compose

$ sudo curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) \
-o /usr/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose

$ sudo curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) \ -o /usr/bin/docker-compose $ sudo chmod +x /usr/local/bin/docker-compose

Check

docker --version
docker-compose --version

docker --version docker-compose --version

Filed Under: Linux Tagged With: amazon, docker, docker-compose, git, install

Run Docker Compose

February 27, 2020

Here’s how to run docker-compose. I have an Icecast docker-compose.yml file. Icecast is an audio streaming server.

version: "2"
 
services:
  icecast:
    image: moul/icecast
    environment:
      - ICECAST_SOURCE_PASSWORD=secret
      - ICECAST_ADMIN_PASSWORD=secret
      - ICECAST_PASSWORD=secret
      - ICECAST_RELAY_PASSWORD=secret
    ports:
      - "8000:8000"
    restart: always

version: "2" services: icecast: image: moul/icecast environment: - ICECAST_SOURCE_PASSWORD=secret - ICECAST_ADMIN_PASSWORD=secret - ICECAST_PASSWORD=secret - ICECAST_RELAY_PASSWORD=secret ports: - "8000:8000" restart: always

To run Icecast in a container , I run docker-compose in the background.

docker-compose up -d

docker-compose up -d

Check to see if Icecast is running on your browser.

http://localhost:8000

http://localhost:8000

To stop the Icecast container, I simply stop the docker-compose.

docker-compose stop

docker-compose stop

Here are the other docker commands you can run.

docker images
docker ps
docker-compose ps

docker images docker ps docker-compose ps

Filed Under: Cloud Tagged With: docker, docker-compose, icecast, start, stop

  • Home
  • About
  • Archives

Copyright © 2023