* gcp(google cloud) centos 에 docker를 이용하여 tensorflow 설치

1 docker 설치
 이전 버전 삭제
 sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine

 최신 저장소 설정
 sudo yum install -y yum-utils device-mapper-persistent-data lvm2
 sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

 최신 버전 설치
 yum install docker-ce
 
 Docker 서비스 등록 및 시작
 sudo systemctl enable docker
 sudo systemctl start docker
 
 ----- 여기 좀 애매함 ---
 도커 그룹 추가

#현재 접속중인 사용자에게 권한 주기

sudo usermod -aG docker $USER

#your-user 사용자에게 권한 주기

sudo usermod -aG docker your-user

2 tensorflow 설치
 - 책마다.... docker를 권장하는데 전부 제각각 버전을 사용한다.
   아무래도 책을 집필하시는 분들이 docker를 잘 모르는거 같다. ㅠ.ㅠ

 sudo docker search tensorflow
 sudo docker run -it -d --name "my-tensorflow" -p 8888:8888 -p 6006:6006 cargo.caicloud.io/tensorflow/tensorflow:1.0.0

 docker run -it -d --name "my-tensorflow" -p 8888:8888 -p 6006:6006 a0c164351caf
 my-tensorflow : 컨테이너명
 a0c164351caf : 이미지명
 호스트포트: 컨테이너포트
 
 docker start my-tensorflow
 docker ps -a
 docker attach my-tensorflow
 docker rm my-tensorflow

 docker run -it -d --name "my-tensorflow" 이미지명
 으로 실행하면 컨테이너가 실행 된다.
 실행중인 컨테이너에 접속하려면 attach로 접속이 안된다.
 이때는
 docker exec -it my-tensorflow /bin/bash를 실행하면 실행된다.
 컨테이너를 종료하지 않고 빠져 나오려면
 Ctrl + P를 누른다음 Ctrl + Q 를 실행하면 된다.

'tensorflow' 카테고리의 다른 글

딥러닝 캐리어 패스  (0) 2022.01.20
colab에 tensorflow 2.x 대 적용하기  (0) 2019.11.13
딥러닝용 PC  (0) 2019.10.22
tensorflow2.0 튜토리얼 시작하기  (0) 2019.10.14
slipp 중간 세미나 tensorflow 발표자료  (0) 2019.10.14
Posted by gt1000

2019. 6. 16. 16:22 java/spring

Rest Doc 관련 링크

http://woowabros.github.io/experience/2018/12/28/spring-rest-docs.html

 

Spring Rest Docs 적용 - 우아한형제들 기술 블로그

안녕하세요? 우아한형제들에서 정산시스템을 개발하고 있는 이호진입니다.지금부터 정산시스템 API 문서를 wiki 에서 Spring Rest Docs 로 전환한 이야기를 해보려고 합니다.

woowabros.github.io

여기 내가 필요한 것을 잘 정리해 둔거 같다.

'java > spring' 카테고리의 다른 글

resttemplate ssl 적용  (0) 2019.06.03
jta atomikos 설정  (0) 2019.03.04
spring boot 백기선님 동영상 강좌 링크  (0) 2018.03.03
springboot 메모  (0) 2017.05.17
rest api 보여 주는 hal-browser  (0) 2017.04.01
Posted by gt1000

https://github.com/jonashackt/spring-boot-rest-clientcertificate/blob/master/src/test/java/de/jonashackt/RestClientCertTestConfiguration.java

 

jonashackt/spring-boot-rest-clientcertificate

Example project showing how to provide a Spring Boot App that serves a secured REST endpoint, that is called with Spring´s RestTemplate configured to use client authentification with a client certi...

github.com

private char[] allPassword = "allpassword".toCharArray();

    @Bean
    public RestTemplate restTemplate(RestTemplateBuilder builder) throws Exception {

        SSLContext sslContext = SSLContextBuilder
                .create()
                .loadKeyMaterial(ResourceUtils.getFile("classpath:keystore.jks"), allPassword, allPassword)
                .loadTrustMaterial(ResourceUtils.getFile("classpath:truststore.jks"), allPassword)
                .build();

        HttpClient client = HttpClients.custom()
                .setSSLContext(sslContext)
                .build();

        return builder
                .requestFactory(new HttpComponentsClientHttpRequestFactory(client))
                .build();
    }

 

키를 입력하지 않고 우회하는 방법은....

@Bean
    public RestTemplate restTemplate()
            throws KeyStoreException, NoSuchAlgorithmException, KeyManagementException {
        TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true;
 
        SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom()
                .loadTrustMaterial(null, acceptingTrustStrategy)
                .build();
 
        SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext);
 
        CloseableHttpClient httpClient = HttpClients.custom()
                .setSSLSocketFactory(csf)
                .build();
 
        HttpComponentsClientHttpRequestFactory requestFactory =
                new HttpComponentsClientHttpRequestFactory();
 
        requestFactory.setHttpClient(httpClient);
        RestTemplate restTemplate = new RestTemplate(requestFactory);
        return restTemplate;
    }

 

 

'java > spring' 카테고리의 다른 글

Rest Doc 관련 링크  (0) 2019.06.16
jta atomikos 설정  (0) 2019.03.04
spring boot 백기선님 동영상 강좌 링크  (0) 2018.03.03
springboot 메모  (0) 2017.05.17
rest api 보여 주는 hal-browser  (0) 2017.04.01
Posted by gt1000

블로그 이미지
gt1000

태그목록

공지사항

어제
오늘

달력

 « |  » 2024.5
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함