teleren/devto huggingface dataset:
Add new Volumes to a running container in docker-compose
Tags: docker, devops, tips
Published: 2020-03-03 15:16:38

---
title: Add new Volumes to a running container in docker-compose
published: true
description: Sequence of steps to add new volumes to a container
tags: docker, devops, tips
---

Consider a situation where you have a set of services running together with docker-compose. Now, For one of your services, You want to have one directory of service to be exported and synced with the host. In other terms, you want to have volume for that directory. ( e.g Downloads, Uploads).

This post shows how to add volume to the running container without letting other services of the network going down.

### Steps
**1. Copy contents of directory from container**
**2. Create a new image from the running container (Commit)**
**3. Stop and Delete running container**
**4. Create a container from the image and specify volume and Network**

## Step 1 - Copy
If path, where we are going to add volume, is not empty, then make sure to copy the content to the host system, As adding a volume will overwrite container data at that location.

List the containers and copy the `id` of running container. 
```bash 
docker ps 
```

Copy the contents of the directory from container, At which volume is going to be mounted.

```bash
docker cp <container-id>:<container path to directory> $(pwd)
```

## Step 2 - Create new Image
This step will create an image from the running container. So the state of running service is preserved.

```bash
docker commit <container-id> <new-image-name>
```

## Step 3 - Delete container
Delete the running container, so new container with added volume will take this place.

```bash
docker stop <container-id> && docker rm <container-id>
```

## Step 4 - Create a new container
Now, We have an image (snapshot) of container available, Which we can use to create another container and add a new volume.

Before proceeding, One important thing to notice is that Our services are running together with **docker-compose**. They can communicate with each other through the network created by **docker-compose**. Now if we create and run the new container. This container will not able to access other services as a new container is not part of the network.  So while creating new container, we have to add this container in the existing **docker-compose** network.

**1. List out the list of docker-compose networks and copy network name**
This will list all the networks, list will include some default networks and also for your service. Find out relevant network and copy network name. 

```bash
docker network ls
```

> Get more details about the network by running **docker inspect NETWORK_ID**

 

**2. Create a new container and run in the existing network**

```bash
docker run -d \
        -v <copied-directory>:<path to volume> \
        --network=<network-name> \
        image-name
```

**copied-directory** - Path to directory copied in **step 1**
**network-name** - Network name identified in **step 4.1**
**image-name** - Image name created in **step 2**

Done.
New service is up in **docker-compose** network with new volume.
Nevertheless, Alyssa Miller (Speaking at LFMS and WiCyS) Coded
Tags: wecoded
Published: 2020-03-03 15:08:37

## Equality
For us to have equality in tech, a community where everyone feels comfortable and welcomed, it is going to take tearing down some major long standing biases. 
- The assumption that women are not technical. 
- The unconscious but very prevalent biases in hiring that create an artificially higher bar for underrepresented groups to land jobs. 
- The very subtle expectations that executive and senior leaders should be men.

These are all things I've experienced and witnessed in my 23 years in tech. To bread these barriers down we need representation. We women, POC, LGBT to be seen and acknowledged in the workforce at all levels so it becomes just as commonplace as seeing the dominant class in those spaces.

## My Expertise
I have been a hacker all my life. I've been working professionally in security for the last 15 years. Being a former developer, I spend a lot of time on Application Security in particular. I'm currently writing a book that is targeted at helping aspiring security professionals get over that initial barrier and start their careers in security.

I'm also a public speaker. I share a lot of topics from DevSecOps, to Deepfakes, to alternative security design, to even how to more effectively communicate with executive levels of management to win support/budget for security initiatives.

## My advice
Be authentic, embrace the things that make you unique and emphasize the characteristics about yourself that make you stand out. Use it on your resume to build curiosity and interest, use it in your daily work to present a different viewpoint, use it in your life to show that you are comfortable and whole in yourself.

Shed this thing we call impostor syndrome. Be objective and acknowledge all that you've accomplished. Do not fall prey to toxic humility. Don't use "I got lucky", "I was helped by so-and-so", etc. as excuses to devalue your successes. We all get help along the way from people and from circumstance, that's how success happens. And finally, understand that you bring something to the table. No one knows everything but yet we tend to assume people have more knowledge than they do. So be proud of what you do know and learn that which you want to know.
Python loop types
Tags: python, beginners
Published: 2020-03-03 15:06:11

In this article we introduce Python's loop, the program in general are executed sequentially. Sequentially means in sequential order (top down):

```
do A
do B
do C
```

In a variety of programming languages, control structures allows for more complex execution paths.

Loop allows us to perform a statement or group of statements *repeatedly*, the following is the general form in most programming languages ​​loop statement:

![python loop](https://dev-to-uploads.s3.amazonaws.com/i/urxflqstc9x0qipigomi.jpg)

Python is provided for and while loops (not do..while loop in Python):

Circulation type | Description
--- | ---
<a href="https://pythonprogramminglanguage.com/while-loop/">The while loop</a> | determines the given condition is true. When the execution loop, or exit the loop.
<a href="https://pythonbasics.org/for-loops/">For loop</a> | Repeat statement
[Nested loop] | You can be nested for loop while loop body

The while loop in code:

```python
>>> index = 0
>>> n = 10
>>> while index < n:
...     print(index)
...     index = index + 1
... 
0
1
2
3
4
5
6
7
8
9
```

The for loop:

```python
>>> for i in range(1,3):
...     print(i)
... 
1
2
```

The nested for loop:

```python
>>> 
>>> for x in range(1,10):
...     for y in range(1,10):
...         print(f"({x},{y})")
```

## loop control statements

Loop control statements can change the order of statement execution. Python loop control supports the following statement:

Control statements | Description
--- | ---
<a href="https://dev.to/libertycodervice/python-break-statement-4ki5">Break Statement</a> | Terminates the loop during the execution of statement block, and jump out of the entire cycle
<a href="https://dev.to/libertycodervice/python-continue-statement-dme">Continue Statement</a> | Terminates the current execution loop statement block, out of the cycle, the next cycle execution.
Pass sentence | pass an empty statement, in order to maintain the integrity of the program structure.
Friday Night Deploys: #13 Sorry, Your Friends Make More Money Than You (#KnowYourWorth)
Tags: podcast, webdev, career, jokes
Published: 2020-03-03 14:36:25

Am I still playing catch up promoting our podcast episodes? I like to think of it like the notifications that go out when you follow us are like the Manga of Friday Night Deploys where our hardcore fans like Andreas and Erica experience, and these posts are like the anime where we mess everything up and gain a separate following that the hardcore followers can evolve into true early adopters or even ascend to hipster levels. What am I doing again?

(Sorry Keith, I brought up anime again.)

Last time the DevPlebs talk about: React portfolios! Matt Hoffman! Ned's Declassified School Survival Guide on Nickelodian! Phil not being able to ride a bike! Deep dish pizzas! Phil betraying the trust of his family! Overeating! Stealing toilet paper from the college! Phil missing the train! Jason Momoa being in Toronto! Hakata Shoryuken Ramen! $3 for a 20 oz pint of Sapporo! Keith's terrible time skiing! Shallow hips! The movie Shallow Hal for some reason? The bullshit of negotiating your salary! Using self-deprecating humour as a defense mechanism! The true meaning behind "The Six"! Barrie Wrestling! Getting paid way too much! Whether or not people like lakes! Reverse osmosis water filtering! Eddie Guerrero (RIP)! Starting an OnlyFans! Keith's alcoholism! Criss Angel Mind Freak! Adorkable misogyny! Salaries n' stuff!

## Listen to The Full Episode!
{% spotify spotify:episode:3rVt3D1Gia3NLe9MYDEg0h%}

**We're also on...**
**Apple Podcasts:** https://podcasts.apple.com/tt/podcast/13-sorry-your-friends-make-more-money-than-you-knowyourworth/id1485252900?i=1000466306923

**Google Music Podcasts:** https://play.google.com/music/m/Dq2ervgscrq6fvsthuijoladjyy?t=13_Sorry_Your_Friends_Make_More_Money_Than_You_KnowYourWorth-Friday_Night_Deploys

**Our Website:** https://www.devplebs.tech/friday-night-deploys/13-sorry-your-friends-make-more-money-than-you-knowyourworth/

## Get In Touch With Us!
If you would like to share some feelings about the know your worth hashtag you want us to read out in the next episode you can reach us at the following...

**Twitter:** [@DevPlebs](https://twitter.com/DevPlebs).
**Email:** deadbeats@devplebs.tech

## Follow Our Twitters... If You Want!
[DevPlebs](https://twitter.com/DevPlebs).
[Keith Brewster](https://twitter.com/brewsterbhg).
[Phil Tietjen](https://twitter.com/phizzard).

You can also ask questions or give us some feedback about the show!
Next Right Now - Flexible production-grade boilerplate for building web apps (monorepo), with Next.js, Zeit and TypeScript
Tags: typescript, nextjs, zeit, monorepo
Published: 2020-03-03 14:27:17

Building a web app is hard. Building a production-grade app with a high Developer Experience is even harder. Configuring all must-needed frameworks and libraries is quite a challenge, and takes weeks, if not months of hard work.

Monitoring, analytics, reusable styles (css-in-js), graphql, i18n, testing, end-to-end testing, deployment pipeline (CI/CD), typescript, serverless... All these things are must-haves in 2020, and making them all work together is another challenge.

That's why we released https://github.com/UnlyEd/next-right-now, a boilerplate to help get started with all that. Though opinionated, it's flexible enough to adapt to your own needs. The goal is to get started with a production-grade setup in a couple of hours, instead of a couple of weeks (at the very least).

There are so many tools in the JS ecosystem now that one must have an opinion on what's good-enough and what isn't. It takes time to compare all css-in-js libraries, and that's just one tiny choice one must do to build isomorphic/universal web applications nowadays.

Next Right Now will help you get started quickly, and can also be used as a great learning resource, because we've documented about everything.

You want to build your own blog? An e-commerce website? Some showcase web app? NRN can help, from development to production.

And, it's flexible. Because you will not agree with all our opinions, and that's fine. Just get rid of what you don't like, as simple as that.

Let us know what you like/dislike!
ตองกับนวัตกรรมของเขา
Published: 2020-03-03 14:21:50

เมื่อเดือนก่อนตองมาเล่าให้ผมฟังเรื่อง Product ที่เขากำลังทำอยู่และจะเปิดบริการในเวลาไม่นาน วันนั้นตองเล่าไม่ละเอียดมากนักจะเมื่ออาทิตย์ก่อนส่ง video promote มาให้ผมดู มันคือการออกแบบระบบเก็บ seed (12 หรือ 24 word ที่เอาไปสร้าง public/private key) ให้กระจายอยู่ตาม Node ต่างๆกระจายอยู่หลายๆที่และถือครองโดยหลายๆ node  มันคือ Decentralized Wallet นั่นเอง ซึ่งจะทำให้ปัญหาการทำ private key หาย และ การขโมย private key ทำได้ยากขึ้น ตองใช้ชื่อ product ว่า [coauth](https://www.coauths.com/) และกำลังจะมี demo app ให้ทดลองใช้เข้าใจว่าจะเป็น Etheruem wallet วันนั้นผมบอกตองว่า Product นี้น่าสนใจมากนอกจากจะเอามาใช้กับ Crypto Wallet มันน่าจะเอาไปใช้กับอะไรได้บ้าง ผมนึกนึงการใช้ private key เพื่อใช้เป็นลายมือชื่ออิเล็กทรอนิกส์ ตาม พรบ.ธุรกรรมทางอิเล็กทรอนิกส์ มาตรา 26 ซึ่งด้วยท่าเดียวกันเราคุยกันว่ามันเอาไปทำ Decentralize ID บน Thaichain ต่อได้ ตามมาตรฐาน [ERC1056[(https://github.com/ethereum/EIPs/issues/1056) ที่ [Uport](https://www.uport.me/) นำเสนอ ตองบอกว่างั้นผมทำเป็นบริการเสริมกับ coauth เลยพี่ๆรอใช้ได้เลย 
ช่วงนี้เป็นช่วงที่ผมยุ่งอยู่กับเร่ือง NDID, IAL , AAL E-open,E-contract,E-Signature เกือบทุกวัน DID น่าจะเป็นเรื่องที่ทำเอามาใช้ทำให้การทำธุรกรรมทางออนไลน์ถูกต้องตามกฏหมายมากยิ่งขึ้น 
บริการใหม่ของตอง cochain นี่ช่างน่าติดตามยิ่งนัก 


เพื่อให้เข้าใจ coauth ง่ายขึ้นมูลนิธิไทยเชนเลยจะสร้าง wallet โดยใช้ coauth จัดการเรื่อง seed จะเป็น ETH wallet ที่สามารถใช้กับ Thaichain, ETH Mainnet ได้ ซึ่งจริงๆแล้ว wallet ไหนก็สามารถใช้บริการ coauth ได้เหมือนกัน......โปรดติดตาม

{% vimeo 395079640 %}

## พรบ.ธุรกรรมทางอิเล็กทรอนิกส์ มาตรา 26

![มาตรา 26](https://dev-to-uploads.s3.amazonaws.com/i/2wiuszzdokkriikiahem.png)
It's possible to find a mentor on Dev.to?
Tags: go, beginners, discuss, mentor
Published: 2020-03-03 14:21:02

I am looking for an experienced mentor in Golang for practical exercises. 
How do you think, it's possible to find anybody on Dev.to? May be someone have such experience? 
I have basic Golang level now, but I want grow and ready to "work for food" if it needed. Just notice, I am not begginer on web dev and have experience with fronend and backed.
Write a GraphQL Mutation using React Hooks with Urql
Tags: javascript, react, urql, graphql
Published: 2020-03-03 14:17:12

---
title: Write a GraphQL Mutation using React Hooks with Urql
published: true
description: Urql is a flexible alternative to Apollo GraphQL client.
tags: javascript, react, urql, graphql
series: Introduction to Urql A Robust GraphQL Client
---


[Watch "Write a GraphQL Mutation using React Hooks with Urql" (community resource) on egghead.](https://egghead.io/lessons/graphql-write-a-graphql-mutation-using-react-hooks-with-urql?pl=introduction-to-urql-a-react-graphql-client-faaa2bf5&af=ay44db)

The first thing we need to do is `import {useMutation} from 'urql'`.

We will call the `useMutation` hook in our component. This hook returns an array with the result in the first slot and a function to execute the mutation in the second.

```js
const App = () => {
  const [res, executeMutation] = useMutation()
}
```

Now we need to define a query that we are going to use. Here is the one I am going to use:

```js
const addCourse = `
  mutation addCourse($slug: String!, $title: String!){
    insert_courses(objects: {slug: $slug, title: $title}) {
      returning {
        title
        slug
      }
    }
  }
```

This query takes a slug and a title as a string (they are both required). The Hasura api I am using defines are `returning` object. So we will grab the title and slug off of the returned object.

Now we can pass this query to our `useMutation` hook.

```js
const [res, executeMutation] = useMutation(addCourse)
```

Lets wire up the wire up the execution method to a button. `executeMutation` takes an object with keys `slug` and `title`. These are the variables we defined in our GraphQL query earlier. We are going to log our `res` variable to see whats returned.

```js
const App = () => {
  const [res, executeMutation] = useMutation(addCourse)
  console.log({ res })
  return (
    <button
      onClick={() => executeMutation({ title: 'My Course', slug: 'my-course' })}
    >
      Create Course
    </button>
  )
}
```

```js
{res: {fetching: true, stale: false, error: undefined, data: undefined, extensions: undefined}}
{res: {fetching: false, stale: false, data: {…}, error: undefined, extensions: undefined}}
```

You can see the result updates when the request starts and again when the query returns the data. This is what the data object looks like:

```js
console.log(res.data)
{
  insert_courses: {
    returning: {
      slug: 'my-course',
      title: 'My Course'
    }
  }
}
```
Video Playback on Mobile Devices
Tags: performance, video
Published: 2020-03-03 14:20:57

---
title: Video Playback on Mobile Devices
published: true
date: 2020-03-03 14:13:03 UTC
tags: Performance,Video
canonical_url: https://dougsillars.com/2020/03/03/video-playback-on-mobile-devices/
---

I see 2 common approaches to dealing with video on mobile browsers: Hide the video with CSS "display:none".  (This results in a partial video download that the user can literally NEVER see). Serve the same video to both mobile and desktop. This video is typically 720p or 1080p, and designed to look great on large … [Continue reading Video Playback on Mobile Devices](https://dougsillars.com/2020/03/03/video-playback-on-mobile-devices/)
Hasura lands a $9.9M to simplify GraphQL development
Tags: graphql, showdev, webdev, opensource
Published: 2020-03-03 14:12:06

---
title: Hasura lands a $9.9M to simplify GraphQL development
published: true
description: Great news for the GraphQL community surfaced last week. A San Francisco-based startup Hasura Inc. announced a $9.9M Series A investment.
tags: graphql,showdev,webdev,opensource
canonical_url: https://blog.graphqleditor.com/graphql-hasura/
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/si8v3utdq4hu4r47m2z2.png
---

Another piece of great news for the GraphQL community surfaced last week. A San Francisco-based startup **Hasura Inc. announced a $9.9M Series A investment!**

Originally **Hasura** was a company aiming to help developers to simplify Kubernetes, but over time the team has realized that there was a much bigger problem they could address - data access. 

Application developers need better access to data sitting in databases.  The Hasura team wants to solve that issue with the help of **GraphQL**, so they have pivoted into an open-source service that takes your databases & with a little bit of configuration allows you to deploy a production-ready GraphQL backend.

![GraphQL with Hasura](https://dev-to-uploads.s3.amazonaws.com/i/3xt0j76lzd6ax595uvui.gif)

##### Source: [hasura.io](https://hasura.io/)

Hasura's software downloads count is soon going to hit a stunning **30 million**! Its open-source software is used by the thousands of development teams in the biggest wide variety of industries including aerospace and healthcare. 

The new funding would let the company raise its headcount which currently oscillates around 40 employees. This would allow them to scale the number of supported database types as well as prepare for the launch of its new enterprise version which should appear on the market this year. As mentioned on **[Hasura's GraphQL blog](https://hasura.io/blog/hasura-2020-the-next-phase-of-our-journey/)** the biggest goals on their road map as for now are:

- Serve the needs of their production & enterprise users on a level better than ever before
- Deliver the GraphQL features that the Hasura community wants
- Expand the Hasura experience to other databases 
- Invest in Hasura community

---

### Keep up doing a great job, congrats to Hasura team! :)

---

## Speed up your GraphQL API development

[**GraphQL Editor**](https://graphqleditor.com/) is a supportive tool for both advanced **GraphQL users** as well as those taking their first steps with GraphQL APIs. Our all-in-one development environment for GraphQL will help you build, manage & deploy your **GraphQL API** much faster thanks to dozens of built-in micro features.

[![GraphQL Editor](https://thepracticaldev.s3.amazonaws.com/i/835ac1nun474qfgn1tfi.gif)](https://graphqleditor.com)
Python JSON
Tags: python, beginners
Published: 2020-03-03 14:10:54

We will introduce how to use the Python language to encode and decode JSON objects. JSON (<a href="https://json.org/">JavaScript Object Notation</a>) is often used in the web, Python can handle it just as well.

Before using Python JSON encode or decode data, we need to first install module `json`. You can use the <a href="https://pythonbasics.org/how-to-use-pip-and-pypi/">pip</a> package manager to do that.

```
pip install json
```

After that you will be able to work with json data. Data in json format looks something like this:

```javascript
{
"name":"Trevor",
"age":25,
"cars":[ "BMW", "Tesla", "Lamborghini" ]
}
```

JSON data is often returned from so called APIs, backends of web applications. If you are new to to Python, you may like <a href="https://gumroad.com/l/dcsp">this book</a>

## JSON Functions

Using JSON `json `library functions (need to import: `import json`). You get these functions:

Function | Description
--- | ---
json.dumps | encoding object to a JSON string Python
json.loads | to decode the encoded JSON string into <a href="https://pythonbasics.org/class/">Python objects</a>

## json.dumps

Python json.dumps for encoding objects into JSON string.
The following examples array JSON format data encoding:

```python
import json

data = [{ 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5}]

json = json.dumps (data)
print(json)
```
The above code execution results:

```python
[{ "A": 1, "c": 3, "b": 2, "e": 5, "d": 4}]
```

Use JSON data format the output parameters so that:

```python
>>> import json
>>>
>>> print(json.dumps({ 'a': 'Runoob', 'b': 7}, sort_keys = True, indent = 4, separators = ( ',', ':')))
{
    "a":"Runoob",
    "b":7
}
>>> 
```

python original type of the conversion table json type:

Python | JSON
--- | ---
dict | object
list, tuple | array
str, unicode | string
int, long, float | number
True | true
False | false
None | null

## json.loads

json.loads JSON data for decoding. This function returns the field data type Python.

The following example shows how to decode JSON objects Python:

```python
import json

jsonData = '{ "a": 1, "b": 2, "c": 3, "d": 4, "e": 5}';

text = json.loads (jsonData)
print(text)
```
The above code execution results:
```python
{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5}
```

json type conversion table to the type of python:

JSON | Python
--- | ---
object | dict
array | list
string | unicode
number (int) | int, long
number (real) | float
true | True
false | False
null | None
  
More Reference:
* <a href="https://pythonspot.com/json-encoding-and-decoding-with-python/">Python json encoding and decoding</a>
* <a href="https://en.wikipedia.org/wiki/JSON">JavaScript Object Notation</a>