Skip to content

Instantly share code, notes, and snippets.

View hqt's full-sized avatar

Huynh Quang Thao hqt

View GitHub Profile

Mistakes to Avoid: Docker Antipatterns

Whichever route you take to implementing containers, you’ll want to steer clear of common pitfalls that can undermine the efficiency of your Docker stack.

Don’t run too many processes inside a single container

The beauty of containers—and an advantage of containers over virtual machines—is that it is easy to make multiple containers interact with one another in order to compose a complete application. There is no need to run a full application inside a single container. Instead, break your application down as much as possible into discrete services, and distribute services across multiple containers. This maximizes flexibility and reliability.

Don’t install operating systems inside Docker containers

It is possible to install a complete Linux operating system inside a container. In most cases, however, this is not necessary. If your goal is to host just a single application or part of an application in the container, you need to install only the essential

@hqt
hqt / logger.go
Created January 8, 2020 12:49
Utility for the Golang log
package vite
import (
"encoding/json"
"fmt"
"log"
"os"
"runtime/debug"
"strings"
DROP PROCEDURE IF EXISTS generate_schema;
DELIMITER $$
CREATE PROCEDURE generate_schema()
BEGIN
DROP TABLE IF EXISTS `foo`;
DROP TABLE IF EXISTS `bar`;
CREATE TABLE `foo`
(
`id` INT NOT NULL AUTO_INCREMENT,
@hqt
hqt / setup_python.sh
Created April 9, 2018 17:36
Setup python environment on Mac
#!/bin/bash
# install python version manager
brew install pyenv
# view all available python versions
pyenv install --list
# select one version and install. i.e: 2.7.14
pyenv install 2.7.14
@hqt
hqt / Makefile
Created April 5, 2014 16:23 — forked from xuhdev/Makefile
# Makefile template for shared library
CC = gcc # C compiler
CFLAGS = -fPIC -Wall -Wextra -O2 -g # C flags
LDFLAGS = -shared # linking flags
RM = rm -f # rm command
TARGET_LIB = libtarget.so # target lib
SRCS = main.c src1.c src2.c # source files
OBJS = $(SRCS:.c=.o)