You can use a minipage
for this.
Here an example:
\documentclass[oneside]{memoir}
\usepackage{tikz}
\usetikzlibrary{shadows.blur}
\usepackage{titletoc}
\usepackage{lipsum}
\usepackage{calc}
\definecolor{yourcolor}{HTML}{008bb2}
%define new chapter style (just for a nicer look)
\makechapterstyle{mystyle}{%
\chapterstyle{default}
\renewcommand*{\chapnumfont}{\normalfont\Huge\sffamily\bfseries}
\renewcommand*{\chaptitlefont}{\normalfont\huge\sffamily\itshape\color{yourcolor}}
\settowidth{\chapindent}{\chapnumfont 111}
\renewcommand*{\chapterheadstart}{}
\renewcommand*{\chapnamefont}{\hfill\color{yourcolor}\normalfont\Huge\sffamily\bfseries}
\renewcommand*{\printchapternum}{%
\begin{tikzpicture}[baseline={([yshift=-.6ex]current bounding box.center)}]
\node[fill=yourcolor,circle,text=white] {\thechapter};
\end{tikzpicture}\\[1ex]
\hrule height 1.5pt}
\renewcommand*{\printchaptertitle}[1]{%
{\chaptitlefont ##1}}
}
%use new chapter style
\chapterstyle{mystyle}
%command to print the acutal minitoc
\newcommand{\printmyminitoc}{\noindent\hspace{-2cm}\begin{tikzpicture}
\node[rounded corners,align=left,fill=yourcolor, blur shadow={shadow blur steps=5}, inner sep=5mm]{%
\color{white}%
\begin{minipage}{8cm}%minipage trick
\printcontents[chapters]{}{1}{}
\end{minipage}};
\end{tikzpicture}}
\begin{document}
\tableofcontents
\chapter{A chapter}
\startcontents[chapters]
%print minitoc
\printmyminitoc
\section{Section}
\lipsum[1]
\section{Section 2}
\section{test}
\section{abc}
\lipsum
\chapter{Second chapter}
\end{document}
Here a quick demo with the book
class. You might want to adjust the page borders. To color the page numbers in the mini toc, I used the method described at https://tex.stackexchange.com/a/186757/10117.
\documentclass[twoside]{book}
\usepackage{tikz}
\usetikzlibrary{shadows.blur}
\usepackage{titletoc}
\usepackage{lipsum}
\usepackage{calc}
\usepackage[]{titlesec}
\definecolor{yourcolor}{HTML}{008bb2}
\colorlet{chpnumbercolor}{black}
\makeatletter
\let\oldl@chapter\l@chapter
\def\l@chapter#1#2{\oldl@chapter{#1}{\textcolor{chpnumbercolor}{#2}}}
\let\old@dottedcontentsline\@dottedtocline
\def\@dottedtocline#1#2#3#4#5{%
\old@dottedcontentsline{#1}{#2}{#3}{#4}{{\textcolor{chpnumbercolor}{#5}}}}
\makeatother
\titleformat{\chapter}[display]
{\normalfont\color{yourcolor}}
{\filleft\Huge\sffamily\bfseries\chaptertitlename\hspace*{2mm}%
\begin{tikzpicture}[baseline={([yshift=-.6ex]current bounding box.center)}]
\node[fill=yourcolor,circle,text=white] {\thechapter};
\end{tikzpicture}}
{1ex}
{\titlerule[1.5pt]\vspace*{5ex}\huge\sffamily\itshape}
[]
\titleformat{name=\chapter,numberless}[display]
{\normalfont\color{yourcolor}}
{}
{1ex}
{\vspace*{5ex}\huge\sffamily\itshape}
[]
%command to print the acutal minitoc
\newcommand{\printmyminitoc}{%
\noindent\hspace{-2cm}%
\colorlet{chpnumbercolor}{white}%
\begin{tikzpicture}
\node[rounded corners,align=left,fill=yourcolor, blur shadow={shadow blur steps=5}, inner sep=5mm]{%
\color{white}%
\begin{minipage}{8cm}%minipage trick
\printcontents[chapters]{}{1}{}
\end{minipage}};
\end{tikzpicture}}
\begin{document}
\tableofcontents
\chapter{A chapter}
\startcontents[chapters]
%print minitoc
\printmyminitoc
\section{Section}
\lipsum[1]
\section{Section 2}
\section{test}
\section{abc}
\lipsum
\chapter{Second chapter}
\end{document}